52 lines
2.1 KiB
Diff
52 lines
2.1 KiB
Diff
--- Python-3.4.3/Lib/ctypes/__init__.py.orig 2015-02-25 05:27:44.000000000 -0600
|
|
+++ Python-3.4.3/Lib/ctypes/__init__.py 2015-05-05 11:39:39.945940300 -0500
|
|
@@ -431,7 +431,8 @@ pydll = LibraryLoader(PyDLL)
|
|
if _os.name == "nt":
|
|
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
|
|
elif _sys.platform == "cygwin":
|
|
- pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
|
|
+ pythonapi = PyDLL("libpython%d.%d%s.dll" % \
|
|
+ (_sys.version_info[:2] + tuple(_sys.abiflags)))
|
|
else:
|
|
pythonapi = PyDLL(None)
|
|
|
|
--- Python-3.4.3/Lib/ctypes/util.py.orig 2015-02-25 05:27:44.000000000 -0600
|
|
+++ Python-3.4.3/Lib/ctypes/util.py 2015-05-05 11:10:45.202655900 -0500
|
|
@@ -80,6 +80,25 @@ if os.name == "posix" and sys.platform =
|
|
continue
|
|
return None
|
|
|
|
+elif sys.platform == "cygwin":
|
|
+ def find_library(name):
|
|
+ for libdir in ['/usr/lib', '/usr/local/lib']:
|
|
+ for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
|
|
+ implib = os.path.join(libdir, libext)
|
|
+ if not os.path.exists(implib):
|
|
+ continue
|
|
+ cmd = "dlltool -I " + implib + " 2>/dev/null"
|
|
+ f = os.popen(cmd)
|
|
+ try:
|
|
+ data = f.read()
|
|
+ finally:
|
|
+ f.close()
|
|
+ res = data.replace("\n","")
|
|
+ if not res:
|
|
+ continue
|
|
+ return res
|
|
+ return None
|
|
+
|
|
elif os.name == "posix":
|
|
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
|
|
import re, tempfile
|
|
@@ -328,6 +347,10 @@ def test():
|
|
print(cdll.LoadLibrary("libcrypto.dylib"))
|
|
print(cdll.LoadLibrary("libSystem.dylib"))
|
|
print(cdll.LoadLibrary("System.framework/System"))
|
|
+ elif sys.platform == "cygwin":
|
|
+ print(cdll.LoadLibrary("cygbz2-1.dll"))
|
|
+ print(cdll.LoadLibrary("cygcrypt-0.dll"))
|
|
+ print(find_library("crypt"))
|
|
# issue-26439 - fix broken test call for AIX
|
|
elif sys.platform.startswith("aix"):
|
|
from ctypes import CDLL
|