Skip to content

Commit 1fd3d22

Browse files
committed
Fix revision number in the OSX version
1 parent f37724e commit 1fd3d22

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modbus_simulator/ui/gui.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
from pkg_resources import resource_filename
2727
from serial.serialutil import SerialException
2828

29+
from distutils.version import LooseVersion
30+
2931
IS_DARWIN = platform.system().lower() == "darwin"
30-
OSX_SIERRA = 10.12
32+
OSX_SIERRA = LooseVersion("10.12")
3133
if IS_DARWIN:
32-
MAC_VERSION = float(platform.mac_ver()[0])
34+
IS_HIGH_SIERRA_OR_ABOVE = LooseVersion(platform.mac_ver()[0])
3335
else:
34-
MAC_VERSION = 0
36+
IS_HIGH_SIERRA_OR_ABOVE = False
3537

36-
DEFAULT_SERIAL_PORT = '/dev/ptyp0' if MAC_VERSION <= OSX_SIERRA else '/dev/ttyp0'
38+
DEFAULT_SERIAL_PORT = '/dev/ptyp0' if not IS_HIGH_SIERRA_OR_ABOVE else '/dev/ttyp0'
3739

3840
if USE_PYMODBUS:
3941
from modbus_simulator.utils.pymodbus_server import ModbusSimu

0 commit comments

Comments
 (0)