Skip to content

Commit 482f22e

Browse files
author
neil-hamilton
authored
Merge pull request picotech#44 from fras/main
Add support for Cygwin.
2 parents 517b00d + 8738b76 commit 482f22e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

picosdk/library.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,20 @@ def __init__(self, name):
6666
def _load(self):
6767
library_path = find_library(self.name)
6868

69-
if library_path is None:
70-
env_var_name = "PATH" if sys.platform == 'win32' else "LD_LIBRARY_PATH"
71-
raise CannotFindPicoSDKError("PicoSDK (%s) not found, check %s" % (self.name, env_var_name))
69+
# 'find_library' fails in Cygwin.
70+
if not sys.platform == 'cygwin':
71+
if library_path is None:
72+
env_var_name = "PATH" if sys.platform == 'win32' else "LD_LIBRARY_PATH"
73+
raise CannotFindPicoSDKError("PicoSDK (%s) not found, check %s" % (self.name, env_var_name))
7274

7375
try:
7476
if sys.platform == 'win32':
7577
from ctypes import WinDLL
7678
result = WinDLL(library_path)
79+
elif sys.platform == 'cygwin':
80+
from ctypes import CDLL
81+
library_path = self.name
82+
result = CDLL(library_path + ".dll")
7783
else:
7884
from ctypes import cdll
7985
result = cdll.LoadLibrary(library_path)

0 commit comments

Comments
 (0)