aboutsummaryrefslogtreecommitdiffstats
path: root/community/python2-tkinter/musl-find_library.patch
diff options
context:
space:
mode:
authorJ0WI <J0WI@users.noreply.github.com>2019-01-23 15:42:31 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2019-01-24 16:29:57 +0000
commita22bed04e6d6950b727d73d46a56ac32beaa305b (patch)
tree11f4ebe23ac4e4141c1d0372b4a983b1aab33599 /community/python2-tkinter/musl-find_library.patch
parentd96309a215754135a99d10a0a43b14ca0bd4d434 (diff)
downloadaports-a22bed04e6d6950b727d73d46a56ac32beaa305b.tar.bz2
aports-a22bed04e6d6950b727d73d46a56ac32beaa305b.tar.xz
community/python2-tkinter: synchronize with main/python2
Diffstat (limited to 'community/python2-tkinter/musl-find_library.patch')
-rw-r--r--community/python2-tkinter/musl-find_library.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/community/python2-tkinter/musl-find_library.patch b/community/python2-tkinter/musl-find_library.patch
new file mode 100644
index 0000000000..7899abb736
--- /dev/null
+++ b/community/python2-tkinter/musl-find_library.patch
@@ -0,0 +1,45 @@
+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:
++ return fh.read(4) == b'\x7fELF'
++ except:
++ return False
++
++ 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 (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:
++ f = os.path.join(d, name)
++ if _is_elf(f):
++ return os.path.basename(f)
++
++ prefix = os.path.join(d, 'lib'+name)
++ for suffix in ['.so', '.so.*']:
++ for f in glob('{0}{1}'.format(prefix, suffix)):
++ if _is_elf(f):
++ return os.path.basename(f)
++
+ else:
+
+ def _findSoname_ldconfig(name):