summaryrefslogtreecommitdiff
path: root/debian/patches/ctypes-arm
blob: 2d49d5474d8fc0c769f913f3dfff12193f77e12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 7 Oct 2017 09:38:57 +0200
Subject: armhf support
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Workaround the presentce of hard-float in ldconfig -p output.
Also, handle the wide variety of ARM unames.

Author: Loïc Minier
Bug-Ubuntu: https://bugs.launchpad.net/bugs/898172
Bug-cpython: http://bugs.python.org/issue13508
Last-Update: 2011-12-19
---
 lib-python/2.7/ctypes/util.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib-python/2.7/ctypes/util.py b/lib-python/2.7/ctypes/util.py
index 16930e4..eb1c8e1 100644
--- a/lib-python/2.7/ctypes/util.py
+++ b/lib-python/2.7/ctypes/util.py
@@ -237,16 +237,27 @@ elif os.name == "posix":
 
         def _findSoname_ldconfig(name):
             import struct
+            # XXX this code assumes that we know all unames and that a single
+            # ABI is supported per uname; instead we should find what the
+            # ABI is (e.g. check ABI of current process) or simply ask libc
+            # to load the library for us
+            uname = os.uname()[4]
+            # ARM has a variety of unames, e.g. armv7l
+            if uname.startswith("arm"):
+                uname = "arm"
             if struct.calcsize('l') == 4:
-                machine = os.uname()[4] + '-32'
+                machine = uname + '-32'
             else:
-                machine = os.uname()[4] + '-64'
+                machine = uname + '-64'
             mach_map = {
                 'x86_64-64': 'libc6,x86-64',
                 'ppc64-64': 'libc6,64bit',
                 'sparc64-64': 'libc6,64bit',
                 's390x-64': 'libc6,64bit',
                 'ia64-64': 'libc6,IA-64',
+                # this actually breaks on biarch or multiarch as the first
+                # library wins; uname doesn't tell us which ABI we're using
+                'arm-32': 'libc6(,hard-float)?',
                 }
             abi_type = mach_map.get(machine, 'libc6')