aboutsummaryrefslogtreecommitdiffstats
path: root/main/python2/musl-find_library.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-11-03 16:06:18 +0200
committerTimo Teräs <timo.teras@iki.fi>2016-11-03 16:08:03 +0200
commitbfdd02d7614b73bcc04f7298ffde0d09d0ad9fbc (patch)
treed6ab7012fee1ee1c784e4a0839832e3b27eac822 /main/python2/musl-find_library.patch
parent5d1f3cfaebff360d742758716c52c42416785e46 (diff)
downloadaports-bfdd02d7614b73bcc04f7298ffde0d09d0ad9fbc.tar.bz2
aports-bfdd02d7614b73bcc04f7298ffde0d09d0ad9fbc.tar.xz
main/python2: improve find_library
ref #5219
Diffstat (limited to 'main/python2/musl-find_library.patch')
-rw-r--r--main/python2/musl-find_library.patch34
1 files changed, 18 insertions, 16 deletions
diff --git a/main/python2/musl-find_library.patch b/main/python2/musl-find_library.patch
index 2d8d19719c..7899abb736 100644
--- a/main/python2/musl-find_library.patch
+++ b/main/python2/musl-find_library.patch
@@ -1,11 +1,13 @@
-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)
+diff -ru Python-2.7.12.orig/Lib/ctypes/util.py Python-2.7.12/Lib/ctypes/util.py
+--- Python-2.7.12.orig/Lib/ctypes/util.py 2016-06-26 00:49:30.000000000 +0300
++++ Python-2.7.12/Lib/ctypes/util.py 2016-11-03 16:05:46.954665040 +0200
+@@ -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 +15,18 @@ index 1e882e3..b265cc0 100644
+ 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 +35,11 @@ index 1e882e3..b265cc0 100644
+ 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):