nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch
Frederik Rietdijk 1da6775775 Python: move interpreters
Move Python interpreters (CPython, PyPy) to same folder and share
layout.
2016-07-28 17:10:15 +02:00

35 lines
1.3 KiB
Diff

--- origsrc/Lib/ctypes/util.py 2007-09-14 15:05:26.000000000 -0500
+++ src/Lib/ctypes/util.py 2008-11-25 17:54:47.319296200 -0600
@@ -41,6 +41,20 @@
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"
+ res = os.popen(cmd).read().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, errno
@@ -157,6 +173,10 @@
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 find_library("crypt")
+ print cdll.LoadLibrary("cygcrypt-0.dll")
else:
print cdll.LoadLibrary("libm.so")
print cdll.LoadLibrary("libcrypt.so")