1
0
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:
Joel Bender
2016-02-04 14:48:35 -05:00
parent f496a8b5ef
commit b13d65bbf2
9 changed files with 42 additions and 6 deletions

View File

@@ -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
#

View File

@@ -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)

View File

@@ -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