diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-08-11 11:16:15 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-08-11 11:19:42 +0200 |
commit | 837f731a38d0a2c1c20c6a4f86cd5368ff02a23b (patch) | |
tree | e0015ca90b53abaa00d4c4a05c86ec8aedabb4d0 /main/python | |
parent | 59b5199ab486881a75bdd72f45679f3dbbfacf4a (diff) | |
download | aports-837f731a38d0a2c1c20c6a4f86cd5368ff02a23b.tar.bz2 aports-837f731a38d0a2c1c20c6a4f86cd5368ff02a23b.tar.xz |
main/python: fix find_library with musl
ref #4512
Diffstat (limited to 'main/python')
-rw-r--r-- | main/python/APKBUILD | 10 | ||||
-rw-r--r-- | main/python/find_library.patch | 11 | ||||
-rw-r--r-- | main/python/musl-find_library.patch | 43 |
3 files changed, 48 insertions, 16 deletions
diff --git a/main/python/APKBUILD b/main/python/APKBUILD index 3a69371533..9f78590b16 100644 --- a/main/python/APKBUILD +++ b/main/python/APKBUILD @@ -2,7 +2,7 @@ pkgname=python pkgver=2.7.10 _verbase=${pkgver%.*} -pkgrel=0 +pkgrel=1 pkgdesc="A high-level scripting language" url="http://www.python.org" arch="all" @@ -15,7 +15,7 @@ depends="" makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev gdbm-dev sqlite-dev libffi-dev readline-dev paxmark" source="http://www.$pkgname.org/ftp/$pkgname/$pkgver/Python-$pkgver.tar.xz - find_library.patch + musl-find_library.patch unchecked-ioctl.patch " @@ -96,11 +96,11 @@ gdbm() { } md5sums="c685ef0b8e9f27b5e3db5db12b268ac6 Python-2.7.10.tar.xz -5d8ca92fa6f187573104593470a9d3d5 find_library.patch +23691939c584e8490948b4331927e4bc musl-find_library.patch dada786a50fa332686a9b9260d84c110 unchecked-ioctl.patch" sha256sums="1cd3730781b91caf0fa1c4d472dc29274186480161a150294c42ce9b5c5effc0 Python-2.7.10.tar.xz -63b2b1489c2b97b450bb2d19b64f2ae6cca5c43d549c131c7807fbe52b7bbf21 find_library.patch +efb0e5312422494be03cfb89b52404d66796e3fd3c6ccb49b32917294d66d93e musl-find_library.patch f9d37609bab83d9ffff96ec9a33e16568cfb14980d389f7fe34a1c837397e359 unchecked-ioctl.patch" sha512sums="67615a6defbcda062f15a09f9dd3b9441afd01a8cc3255e5bc45b925378a0ddc38d468b7701176f6cc153ec52a4f21671b433780d9bde343aa9b9c1b2ae29feb Python-2.7.10.tar.xz -cbb18c23b1b55025ba8a08debd545b68317eef2732f9f631d2629ed71b603b9a90843bca5df9db7072e83e29c928b0e9c557d0710955692052607db36a241c08 find_library.patch +382e86e53f9d87c3e6b36c56f8296eab2f24a20ba1fb0a1fdcbe40f6bbb51c93ab03403499f7c9f6a33430eb69b81fc613d430a37880bde9fbe510503c409529 musl-find_library.patch 5a8e013a4132d71c4360771f130d27b37275ae59330cf9a75378dc8a11236017f540eb224f2a148984e82ca3fb6b29129375b1080ba05b81044faa717520ab82 unchecked-ioctl.patch" diff --git a/main/python/find_library.patch b/main/python/find_library.patch deleted file mode 100644 index c4975250bb..0000000000 --- a/main/python/find_library.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./Lib/ctypes/util.py.orig -+++ ./Lib/ctypes/util.py -@@ -227,7 +227,7 @@ - abi_type = mach_map.get(machine, 'libc6') - - # XXX assuming GLIBC's ldconfig (with option -p) -- expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) -+ expr = r'\s+(lib%s\.[^\s]+)\s+\(' % (re.escape(name)) - f = os.popen('/sbin/ldconfig -p 2>/dev/null') - try: - data = f.read() diff --git a/main/python/musl-find_library.patch b/main/python/musl-find_library.patch new file mode 100644 index 0000000000..aad604c451 --- /dev/null +++ b/main/python/musl-find_library.patch @@ -0,0 +1,43 @@ +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 1e882e3..b265cc0 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -238,8 +238,37 @@ elif os.name == "posix": + return None + return res.group(1) + ++ def _is_elf(filepath): ++ try: ++ with open(filepath, 'rb') as fh: ++ return fh.read(4) == b'\x7fELF' ++ except: ++ return False ++ ++ def _find_libfile(name): ++ from glob import glob ++ # special case for libm, libcrypt and libpthread and musl ++ if name in ['m', 'crypt', 'pthread']: ++ name = 'c' ++ elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']: ++ name = 'libc.so' ++ # search in standard locations ++ paths = ['/lib', '/usr/lib', '/usr/local/lib'] ++ if 'LD_LIBRARY_PATH' in os.environ: ++ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths ++ for d in paths: ++ f = os.path.join(d, name) ++ if _is_elf(f): ++ return f ++ ++ prefix = os.path.join(d, 'lib'+name) ++ for suffix in ['.so', '.so.*', '.*.so.*']: ++ for f in glob('{0}{1}'.format(prefix, suffix)): ++ if _is_elf(f): ++ return f ++ + def find_library(name): +- return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) ++ return _find_libfile(name) or _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) + + ################################################################ + # test code |