diff --git a/srcpkgs/python/patches/musl-find_library.patch b/srcpkgs/python/patches/musl-find_library.patch index 9e5462c0c53..ec9f3d94f15 100644 --- a/srcpkgs/python/patches/musl-find_library.patch +++ b/srcpkgs/python/patches/musl-find_library.patch @@ -1,11 +1,12 @@ -http://bugs.alpinelinux.org/issues/5038 - ---- Lib/ctypes/util.py +--- Lib/ctypes/util.py.orig +++ Lib/ctypes/util.py -@@ -238,8 +238,37 @@ elif os.name == "posix": - return None - return res.group(1) +@@ -204,6 +204,41 @@ + def find_library(name, is64 = False): + return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) ++ elif True: ++ ++ # Patched for Alpine Linux / musl - search manually system paths + def _is_elf(filepath): + try: + with open(filepath, 'rb') as fh: @@ -13,15 +14,18 @@ http://bugs.alpinelinux.org/issues/5038 + except: + return False + -+ def _find_libfile(name): ++ def find_library(name): + from glob import glob ++ # absolute name? ++ if os.path.isabs(name): ++ return name + # 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'] ++ # search in standard locations (musl order) ++ paths = ['/lib', '/usr/local/lib', '/usr/lib'] + if 'LD_LIBRARY_PATH' in os.environ: + paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths + for d in paths: @@ -30,14 +34,11 @@ http://bugs.alpinelinux.org/issues/5038 + return os.path.basename(f) + + prefix = os.path.join(d, 'lib'+name) -+ for suffix in ['.so', '.so.*', '.*.so.*']: ++ for suffix in ['.so', '.so.*']: + for f in glob('{0}{1}'.format(prefix, suffix)): + if _is_elf(f): + return os.path.basename(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)) + else: - ################################################################ - # test code + def _findSoname_ldconfig(name): diff --git a/srcpkgs/python/template b/srcpkgs/python/template index 5975d506041..248e29e9667 100644 --- a/srcpkgs/python/template +++ b/srcpkgs/python/template @@ -4,7 +4,7 @@ # pkgname=python version=2.7.12 -revision=2 +revision=3 wrksrc="Python-${version}" hostmakedepends="pkg-config" makedepends="