Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

32-bit Linux running on 64-bit ARM arch should have platform "linux_armv7l" #234

Merged
merged 15 commits into from
Feb 6, 2020
7 changes: 5 additions & 2 deletions packaging/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,11 @@ def _have_compatible_manylinux_abi(arch):
def _linux_platforms(is_32bit=_32_BIT_INTERPRETER):
# type: (bool) -> Iterator[str]
linux = _normalize_string(distutils.util.get_platform())
if linux == "linux_x86_64" and is_32bit:
linux = "linux_i686"
if is_32bit:
if linux == "linux_x86_64":
linux = "linux_i686"
elif linux == "linux_aarch64":
brettcannon marked this conversation as resolved.
Show resolved Hide resolved
linux = "linux_armv7l"
manylinux_support = []
_, arch = linux.split("_", 1)
if _have_compatible_manylinux_abi(arch):
Expand Down
20 changes: 20 additions & 0 deletions tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def is_x86():
return re.match(r"(i\d86|x86_64)", platform.machine()) is not None


@pytest.fixture
def is_arm():
return re.match(r"(armv\d|aarch64)", platform.machine()) is not None


@pytest.fixture
def is_64bit_os():
return platform.architecture()[0] == "64bit"
Expand Down Expand Up @@ -429,6 +434,21 @@ def test_linux_platforms_32bit_on_64bit_os(self, is_64bit_os, is_x86, monkeypatc
linux_platform = list(tags._linux_platforms(is_32bit=True))[-1]
assert linux_platform == "linux_i686"

def test_linux_platforms_64bit_on_64bit_os_arm(self, is_64bit_os, is_arm, monkeypatch):
if platform.system() != "Linux" or not is_64bit_os or not is_arm:
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_aarch64")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
linux_platform = tags._linux_platforms(is_32bit=False)[-1]
xuhdev marked this conversation as resolved.
Show resolved Hide resolved
assert linux_platform == "linux_aarch64"


def test_linux_platforms_32bit_on_64bit_os_arm(self, is_64bit_os, is_arm, monkeypatch):
if platform.system() != "Linux" or not is_64bit_os or not is_arm:
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_aarch64")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
linux_platform = tags._linux_platforms(is_32bit=True)[-1]
xuhdev marked this conversation as resolved.
Show resolved Hide resolved
assert linux_platform == "linux_armv7l"

def test_linux_platforms_manylinux_unsupported(self, monkeypatch):
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
Expand Down