Skip to content

Commit c6e1f5b

Browse files
committed
Support PCAN interface on cygwin
Unfortunately, cygwin has no winreg module, so we have to use cygwinreg instead.
1 parent 9908056 commit c6e1f5b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

can/interfaces/pcan/basic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
if platform.system() == "Windows":
1919
import winreg
20+
elif 'CYGWIN' in platform.system():
21+
import cygwinreg as winreg
2022

2123

2224
logger = logging.getLogger("can.pcan")
@@ -535,7 +537,7 @@ class PCANBasic:
535537

536538
def __init__(self):
537539
# Loads the PCANBasic.dll and checks if driver is available
538-
if platform.system() == "Windows":
540+
if platform.system() == "Windows" or "CYGWIN" in platform.system():
539541
self.__m_dllBasic = windll.LoadLibrary("PCANBasic")
540542
aReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
541543
try:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"filelock",
110110
"mypy_extensions >= 0.4.0, < 0.5.0",
111111
'pywin32;platform_system=="Windows"',
112+
'cygwinreg;sys_platform=="cygwin"',
112113
],
113114
setup_requires=pytest_runner,
114115
extras_require=extras_require,

0 commit comments

Comments
 (0)