Package: pypy3
Version: 7.3.1

The following exception may be thrown:

  File "/usr/lib/pypy3/lib-python/3/ctypes/util.py", line 259, in
_findSoname_ldconfig
    machine = uname.machine + '-32'
AttributeError: 'str' object has no attribute 'machine'

This is caused by a simple mistake in debian/patches/ctypes-arm.

This patch works fine:

From: Stefano Rivera <[email protected]>
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

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: 2017-05-21
---
 lib-python/3/ctypes/util.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib-python/3/ctypes/util.py b/lib-python/3/ctypes/util.py
index 339ae8a..ac78290 100644
--- a/lib-python/3/ctypes/util.py
+++ b/lib-python/3/ctypes/util.py
@@ -247,16 +247,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
+            machine = os.uname().machine
+            # ARM has a variety of unames, e.g. armv7l
+            if machine.startswith("arm"):
+                machine = "arm"
             if struct.calcsize('l') == 4:
-                machine = os.uname().machine + '-32'
+                machine = machine + '-32'
             else:
-                machine = os.uname().machine + '-64'
+                machine = machine + '-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')

Reply via email to