From 79ae584b0a2525938db6e7cb36b5b7721b511ad0 Mon Sep 17 00:00:00 2001 From: mayeut Date: Mon, 10 Apr 2023 19:30:04 +0200 Subject: [PATCH] Use armv7l policy for 64-bit arm kernel in 32-bit mode (armv8l) --- src/auditwheel/policy/__init__.py | 9 ++++++--- tests/unit/test_policy.py | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/auditwheel/policy/__init__.py b/src/auditwheel/policy/__init__.py index ba5348f4..97fd3888 100644 --- a/src/auditwheel/policy/__init__.py +++ b/src/auditwheel/policy/__init__.py @@ -23,9 +23,12 @@ def get_arch_name() -> str: machine = _platform_module.machine() if sys.platform == "darwin" and machine == "arm64": return "aarch64" - if machine not in {"x86_64", "i686"}: - return machine - return {64: "x86_64", 32: "i686"}[bits] + if machine in {"x86_64", "i686"}: + return {64: "x86_64", 32: "i686"}[bits] + if machine in {"aarch64", "armv8l"}: + # use armv7l policy for 64-bit arm kernel in 32-bit mode (armv8l) + return {64: "aarch64", 32: "armv7l"}[bits] + return machine _ARCH_NAME = get_arch_name() diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py index 52c94591..9fa21c9b 100644 --- a/tests/unit/test_policy.py +++ b/tests/unit/test_policy.py @@ -20,6 +20,8 @@ [ ("armv6l", "armv6l"), ("armv7l", "armv7l"), + ("armv8l", "armv7l"), + ("aarch64", "armv7l"), ("i686", "i686"), ("x86_64", "i686"), ], @@ -35,8 +37,10 @@ def test_32bits_arch_name(machine_mock, reported_arch, expected_arch): @pytest.mark.parametrize( "reported_arch,expected_arch", [ + ("armv8l", "aarch64"), ("aarch64", "aarch64"), ("ppc64le", "ppc64le"), + ("i686", "x86_64"), ("x86_64", "x86_64"), ], )