Skip to content

Commit

Permalink
Support PCAN interface on cygwin
Browse files Browse the repository at this point in the history
Unfortunately, cygwin has no winreg module, so we have to use cygwinreg
instead.
  • Loading branch information
henzef committed May 19, 2020
1 parent 9908056 commit c6e1f5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion can/interfaces/pcan/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

if platform.system() == "Windows":
import winreg
elif 'CYGWIN' in platform.system():
import cygwinreg as winreg


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

def __init__(self):
# Loads the PCANBasic.dll and checks if driver is available
if platform.system() == "Windows":
if platform.system() == "Windows" or "CYGWIN" in platform.system():
self.__m_dllBasic = windll.LoadLibrary("PCANBasic")
aReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"filelock",
"mypy_extensions >= 0.4.0, < 0.5.0",
'pywin32;platform_system=="Windows"',
'cygwinreg;sys_platform=="cygwin"',
],
setup_requires=pytest_runner,
extras_require=extras_require,
Expand Down

0 comments on commit c6e1f5b

Please sign in to comment.