Skip to content

Commit

Permalink
Added support for armv7l
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauszus committed Dec 12, 2024
1 parent c5d8d9b commit b0a473f
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/gen-scie-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
os: ubuntu-24.04
docker-arch: arm64
artifact-name: linux-aarch64
- platform: Linux armv7l
os: ubuntu-24.04
docker-arch: arm/v7
artifact-name: linux-armv7l
- platform: macOS x86_64
os: macos-13
artifact-name: macos-x86_64
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ __pycache__/
/.tox/
/dist/
/docs/_static_dynamic/

.idea/
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 2.26.0

This release adds support for Linux ARM (armv7l and armv8l 32 bit mode).

## 2.25.2

This release fixes the `--elide-unused-requires-dist` lock option once
Expand Down
1 change: 1 addition & 0 deletions package/package.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pex-extras = [

platforms = [
"linux-aarch64",
"linux-armv7l",
"linux-x86_64",
"macos-aarch64",
"macos-x86_64",
Expand Down
18 changes: 14 additions & 4 deletions pex/scie/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ def __get__(self, obj, objtype=None):
if "linux" == system:
if machine in ("aarch64", "arm64"):
self._current = SciePlatform.LINUX_AARCH64
elif machine in ("armv7l", "armv8l"):
self._current = SciePlatform.LINUX_ARMV7L
elif machine in ("amd64", "x86_64"):
self._current = SciePlatform.LINUX_X86_64
elif "darwin" == system:
Expand Down Expand Up @@ -288,6 +290,7 @@ def qualified_file_name(self, file_name):
return "{stem}-{platform}{ext}".format(stem=stem, platform=self, ext=ext)

LINUX_AARCH64 = Value("linux-aarch64")
LINUX_ARMV7L = Value("linux-armv7l")
LINUX_X86_64 = Value("linux-x86_64")
MACOS_AARCH64 = Value("macos-aarch64")
MACOS_X86_64 = Value("macos-x86_64")
Expand Down Expand Up @@ -441,14 +444,18 @@ def _from_platform_specs(

platform_str = platform_spec.platform
is_aarch64 = "arm64" in platform_str or "aarch64" in platform_str
is_armv7l = "armv7l" in platform_str or "armv8l" in platform_str
is_x86_64 = "amd64" in platform_str or "x86_64" in platform_str
if not is_aarch64 ^ is_x86_64:
if not is_aarch64 ^ is_armv7l ^ is_x86_64:
continue

if "linux" in platform_str:
scie_platform = (
SciePlatform.LINUX_AARCH64 if is_aarch64 else SciePlatform.LINUX_X86_64
)
if is_aarch64:
scie_platform = SciePlatform.LINUX_AARCH64
elif is_armv7l:
scie_platform = SciePlatform.LINUX_ARMV7L
else:
scie_platform = SciePlatform.LINUX_X86_64
elif "mac" in platform_str:
scie_platform = (
SciePlatform.MACOS_AARCH64 if is_aarch64 else SciePlatform.MACOS_X86_64
Expand All @@ -474,6 +481,9 @@ def _from_platform_specs(
and plat_python_version < (3, 7)
):
continue
# PyPy distributions is not available for Linux armv7l
if SciePlatform.LINUX_ARMV7L is scie_platform:
continue
# PyPy distributions for Mac arm64 start with 3.8 (and PyPy always releases for
# 2.7).
if (
Expand Down
4 changes: 2 additions & 2 deletions pex/scie/science.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def _science_binary_url(suffix=""):
)


PTEX_VERSION = "1.1.1"
SCIE_JUMP_VERSION = "1.1.1"
PTEX_VERSION = "1.4.0"
SCIE_JUMP_VERSION = "1.4.1"


@attr.s(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion pex/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

__version__ = "2.25.2"
__version__ = "2.26.0"
3 changes: 3 additions & 0 deletions scripts/build-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class Platform(Enum):
Linux_aarch64 = "aarch64-unknown-linux-musl"
Linux_armv7l = "armv7-unknown-linux-musleabihf"
Linux_x86_64 = "x86_64-unknown-linux-musl"
Macos_aarch64 = "aarch64-apple-darwin"
Macos_x86_64 = "x86_64-apple-darwin"
Expand All @@ -42,6 +43,8 @@ def current(cls) -> Platform:
if system == "linux":
if machine in ("aarch64", "arm64"):
return cls.Linux_aarch64
elif machine in ("armv7l", "armv8l"):
return cls.Linux_armv7l
elif machine in ("amd64", "x86_64"):
return cls.Linux_x86_64
elif system == "darwin":
Expand Down
2 changes: 2 additions & 0 deletions scripts/gen-scie-platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def current_platform() -> str:
machine = platform.machine().lower()
if machine in ("aarch64", "arm64"):
return f"{system}-aarch64"
elif machine in ("armv7l", "armv8l"):
return f"{system}-armv7l"
elif machine in ("amd64", "x86_64"):
return f"{system}-x86_64"
raise ValueError(f"Unexpected platform.machine(): {platform.machine()}")
Expand Down
2 changes: 2 additions & 0 deletions testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@
IS_MAC = platform.system() == "Darwin"
IS_X86_64 = platform.machine().lower() in ("amd64", "x86_64")
IS_ARM_64 = platform.machine().lower() in ("arm64", "aarch64")
IS_ARMV7L = platform.machine().lower() in ("armv7l", "armv8l")
IS_LINUX_X86_64 = IS_LINUX and IS_X86_64
IS_LINUX_ARM64 = IS_LINUX and IS_ARM_64
IS_LINUX_ARMV7L = IS_LINUX and IS_ARMV7L
IS_MAC_X86_64 = IS_MAC and IS_X86_64
IS_MAC_ARM64 = IS_MAC and IS_ARM_64
NOT_CPYTHON27_OR_OSX = NOT_CPYTHON27 or not IS_LINUX
Expand Down
9 changes: 8 additions & 1 deletion tests/integration/scie/test_pex_scie.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def create_scies(
"--platform",
"linux-aarch64-cp-39-cp39",
"--platform",
"linux-armv7l-cp-311-cp311",
"--platform",
"linux-x86_64-cp-310-cp310",
"--platform",
"macosx-10.9-arm64-cp-311-cp311",
Expand All @@ -172,6 +174,7 @@ def create_scies(

python_version_by_platform = {
SciePlatform.LINUX_AARCH64: "3.9",
SciePlatform.LINUX_ARMV7L: "3.11",
SciePlatform.LINUX_X86_64: "3.10",
SciePlatform.MACOS_AARCH64: "3.11",
SciePlatform.MACOS_X86_64: "3.12",
Expand Down Expand Up @@ -228,13 +231,14 @@ def assert_platforms(
output_dir=all_platforms_output_dir,
expected_platforms=(
SciePlatform.LINUX_AARCH64,
SciePlatform.LINUX_ARMV7L,
SciePlatform.LINUX_X86_64,
SciePlatform.MACOS_AARCH64,
SciePlatform.MACOS_X86_64,
),
)

# Now restrict the PEX's implied natural platform set of 4 down to 2 or 3 using
# Now restrict the PEX's implied natural platform set of 5 down to 2 or 3 using
# `--scie-platform`.
restricted_platforms_output_dir = os.path.join(str(tmpdir), "restricted-platforms")
create_scies(
Expand Down Expand Up @@ -389,6 +393,7 @@ def make_20240415_3_10_14_url(platform):
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-gnu",
)
}
Expand All @@ -412,6 +417,8 @@ def make_20240415_3_10_14_url(platform):
expected_platform = None # type: Optional[str]
if SciePlatform.CURRENT is SciePlatform.LINUX_AARCH64:
expected_platform = "aarch64-unknown-linux-gnu"
elif SciePlatform.CURRENT is SciePlatform.LINUX_ARMV7L:
expected_platform = "armv7-unknown-linux-gnueabihf"
elif SciePlatform.CURRENT is SciePlatform.LINUX_X86_64:
expected_platform = "x86_64-unknown-linux-gnu"
elif SciePlatform.CURRENT is SciePlatform.MACOS_AARCH64:
Expand Down
1 change: 1 addition & 0 deletions tests/test_pep_508.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def assert_platform_machine(
assert_platform_machine("x86_64", "manylinux2014-x86_64-cp-37-cp37m")
assert_platform_machine("x86_64", "manylinux_2_5-x86_64-cp-37-cp37m")
assert_platform_machine("aarch64", "manylinux_2_77-aarch64-cp-37-cp37m")
assert_platform_machine("armv7l", "linux-armv7l-cp-311-cp311")

assert_platform_machine("x86_64", "macosx-10.15-x86_64-cp-38-m")
assert_platform_machine("arm64", "macosx-11.0-arm64-cp-39-cp39")

0 comments on commit b0a473f

Please sign in to comment.