mirror of
https://github.com/JoelBender/bacpypes
synced 2025-10-27 00:57:47 +08:00
simplify the platform check and add a warning
This commit is contained in:
@@ -2,6 +2,18 @@
|
||||
|
||||
"""BACnet Python Package"""
|
||||
|
||||
#
|
||||
# Platform Check
|
||||
#
|
||||
|
||||
import sys as _sys
|
||||
import warnings as _warnings
|
||||
|
||||
_supported_platforms = ('linux2', 'win32', 'darwin')
|
||||
|
||||
if _sys.platform not in _supported_platforms:
|
||||
_warnings.warn("unsupported platform", RuntimeWarning)
|
||||
|
||||
#
|
||||
# Communications Core Modules
|
||||
#
|
||||
|
||||
@@ -91,7 +91,7 @@ class UDPMultiplexer:
|
||||
bind(self.direct, self.directPort)
|
||||
|
||||
# create and bind the broadcast address for non-Windows
|
||||
if specialBroadcast and (not noBroadcast) and 'win' not in sys.platform:
|
||||
if specialBroadcast and (not noBroadcast) and sys.platform in ('linux2', 'darwin'):
|
||||
self.broadcast = _MultiplexClient(self)
|
||||
self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True)
|
||||
bind(self.direct, self.broadcastPort)
|
||||
|
||||
@@ -21,7 +21,7 @@ _task_manager = None
|
||||
_unscheduled_tasks = []
|
||||
|
||||
# only defined for linux platforms
|
||||
if sys.platform.startswith(('linux', 'darwin')):
|
||||
if sys.platform in ('linux2', 'darwin'):
|
||||
from .event import WaitableEvent
|
||||
#
|
||||
# _Trigger
|
||||
|
||||
Reference in New Issue
Block a user