Skip to content

Commit

Permalink
Use armv7l policy for 64-bit arm kernel in 32-bit mode (armv8l)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Apr 10, 2023
1 parent fd78b6f commit 4f44c47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/auditwheel/policy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
[
("armv6l", "armv6l"),
("armv7l", "armv7l"),
("armv8l", "armv7l"),
("aarch64", "armv7l"),
("i686", "i686"),
("x86_64", "i686"),
],
Expand All @@ -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"),
],
)
Expand Down

0 comments on commit 4f44c47

Please sign in to comment.