From 195d8fd91e5e803331dc02a42d4877cff2fc5a94 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Fri, 13 Dec 2024 03:27:02 +0100 Subject: [PATCH] Added support for armv7l (#2620) Co-authored-by: John Sirois --- .github/workflows/gen-scie-platforms.yml | 16 +-- package/package.toml | 22 +++-- package/scie_config.py | 121 +++++++++++++++++++++-- pex/scie/model.py | 18 +++- pex/scie/science.py | 8 +- scripts/build-docs.py | 3 +- scripts/create-packages.py | 36 +++---- scripts/gen-scie-platform.py | 66 +++++-------- testing/__init__.py | 2 + tests/integration/scie/test_pex_scie.py | 13 ++- tests/test_pep_508.py | 1 + tox.ini | 4 + 12 files changed, 214 insertions(+), 96 deletions(-) diff --git a/.github/workflows/gen-scie-platforms.yml b/.github/workflows/gen-scie-platforms.yml index 470fe817c..8ade61c63 100644 --- a/.github/workflows/gen-scie-platforms.yml +++ b/.github/workflows/gen-scie-platforms.yml @@ -2,11 +2,8 @@ name: Generate Pex Scie Complete Platforms on: workflow_dispatch: inputs: - pbs-release: - description: The PBS release to use. - required: true - python-version: - description: The PBS Python version to use. + encoded-scie-config: + description: The encoded Pex PEX scie package.toml config to use. required: true defaults: run: @@ -27,6 +24,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 @@ -53,8 +54,7 @@ jobs: tox -e gen-scie-platform -- \ -d "${dest_dir}" \ - --pbs-release ${{ github.event.inputs.pbs-release }} \ - --python-version ${{ github.event.inputs.python-version }} + --encoded-scie-config ${{ github.event.inputs.encoded-scie-config }} EOF chmod +x ./gen-scie-platform.sh - name: Setup Docker QEMU Emulation @@ -71,7 +71,7 @@ jobs: -v $PWD:/code \ -w /code \ --platform linux/${{ matrix.docker-arch }} \ - python:3.11-slim-bullseye bash ./gen-scie-platform.sh + python:3.11-slim-bookworm bash ./gen-scie-platform.sh - name: Setup Python 3.11 if: ${{ ! matrix.docker-arch }} uses: actions/setup-python@v5 diff --git a/package/package.toml b/package/package.toml index c433a18f7..4dd348164 100644 --- a/package/package.toml +++ b/package/package.toml @@ -1,14 +1,20 @@ [scie] -pbs-release = "20241016" -python-version = "3.13.0" +pbs-release = "20241206" +python-version = "3.13.1" pex-extras = [ "management", ] -platforms = [ - "linux-aarch64", - "linux-x86_64", - "macos-aarch64", - "macos-x86_64", -] +[scie.platforms.linux-aarch64] + +[scie.platforms.linux-armv7l] +# This customization gets us a lockable psutil wheel. +python-version = "3.11.11" +extra-lock-args = ["--index", "https://www.piwheels.org/simple"] +# TODO(John Sirois): Remove once the complete platform file is generated. +required = false + +[scie.platforms.linux-x86_64] +[scie.platforms.macos-aarch64] +[scie.platforms.macos-x86_64] diff --git a/package/scie_config.py b/package/scie_config.py index c97717463..71a94dcfd 100644 --- a/package/scie_config.py +++ b/package/scie_config.py @@ -3,29 +3,130 @@ from __future__ import annotations +import base64 +import json import pkgutil +import platform +from collections import Counter from dataclasses import dataclass +from typing import Any import toml +@dataclass(frozen=True) +class PlatformConfig: + @classmethod + def load( + cls, + *, + name: str, + platform_data: dict[str, Any], + default_pbs_release: str, + default_python_version: str + ) -> PlatformConfig: + return cls( + name=name, + pbs_release=platform_data.get("pbs-release", default_pbs_release), + python_version=platform_data.get("python-version", default_python_version), + extra_lock_args=tuple(platform_data.get("extra-lock-args", ())), + required=platform_data.get("required", True), + ) + + name: str + pbs_release: str + python_version: str + extra_lock_args: tuple[str, ...] = () + required: bool = True + + @dataclass(frozen=True) class ScieConfig: @classmethod def load( - cls, *, pbs_release: str | None = None, python_version: str | None = None + cls, + *, + pbs_release: str | None = None, + python_version: str | None = None, + encoded_config: str | None = None ) -> ScieConfig: - data = pkgutil.get_data(__name__, "package.toml") - assert data is not None, f"Expected to find a sibling package.toml file to {__file__}." - scie_config = toml.loads(data.decode())["scie"] + if encoded_config: + scie_config = json.loads(base64.urlsafe_b64decode(encoded_config)) + else: + data = pkgutil.get_data(__name__, "package.toml") + assert data is not None, f"Expected to find a sibling package.toml file to {__file__}." + scie_config = toml.loads(data.decode())["scie"] + default_pbs_release = pbs_release or scie_config["pbs-release"] + default_python_version = python_version or scie_config["python-version"] + return cls( - pbs_release=pbs_release or scie_config["pbs-release"], - python_version=python_version or scie_config["python-version"], pex_extras=tuple(scie_config["pex-extras"]), - platforms=tuple(scie_config["platforms"]), + platforms=tuple( + PlatformConfig.load( + name=platform_name, + platform_data=platform_data, + default_pbs_release=default_pbs_release, + default_python_version=default_python_version, + ) + for platform_name, platform_data in scie_config.get("platforms", {}).items() + ), ) - pbs_release: str - python_version: str pex_extras: tuple[str, ...] - platforms: tuple[str, ...] + platforms: tuple[PlatformConfig, ...] + + def current_platform(self) -> PlatformConfig: + system = platform.system().lower() + if system == "darwin": + system = "macos" + machine = platform.machine().lower() + if machine in ("aarch64", "arm64"): + plat = f"{system}-aarch64" + elif machine in ("armv7l", "armv8l"): + plat = f"{system}-armv7l" + elif machine in ("amd64", "x86_64"): + plat = f"{system}-x86_64" + else: + raise ValueError(f"Unexpected platform.machine(): {platform.machine()}") + + for platform_config in self.platforms: + if platform_config.name == plat: + return platform_config + raise KeyError( + f"This scie configuration does not contain an entry for platform {plat!r}, only the " + f"following platforms are defined: " + f"{', '.join(platform_config.name for platform_config in self.platforms)}" + ) + + def encode(self) -> str: + pbs_releases: Counter[str] = Counter() + python_versions: Counter[str] = Counter() + for platform_config in self.platforms: + pbs_releases[platform_config.pbs_release] += 1 + python_versions[platform_config.python_version] += 1 + default_pbs_release, _count = pbs_releases.most_common(n=1)[0] + default_python_version, _count = python_versions.most_common(n=1)[0] + + platforms = {} + for platform_config in self.platforms: + data: dict[str, Any] = {} + if platform_config.pbs_release != default_pbs_release: + data["pbs-release"] = platform_config.pbs_release + if platform_config.python_version != default_python_version: + data["python-version"] = platform_config.python_version + if platform_config.extra_lock_args: + data["extra-lock-args"] = platform_config.extra_lock_args + if not platform_config.required: + data["required"] = False + platforms[platform_config.name] = data + + return base64.urlsafe_b64encode( + json.dumps( + { + "pbs-release": default_pbs_release, + "python-version": default_python_version, + "pex-extras": self.pex_extras, + "platforms": platforms, + } + ).encode() + ).decode("ascii") diff --git a/pex/scie/model.py b/pex/scie/model.py index 3b87425e5..98f4a5b9c 100644 --- a/pex/scie/model.py +++ b/pex/scie/model.py @@ -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: @@ -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") @@ -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 @@ -474,6 +481,9 @@ def _from_platform_specs( and plat_python_version < (3, 7) ): continue + # PyPy distributions are 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 ( diff --git a/pex/scie/science.py b/pex/scie/science.py index 64d01072c..d42dd2cbc 100644 --- a/pex/scie/science.py +++ b/pex/scie/science.py @@ -64,7 +64,7 @@ def qualified_binary_name(self, binary_name): SCIENCE_RELEASES_URL = "https://github.com/a-scie/lift/releases" -MIN_SCIENCE_VERSION = Version("0.8.0") +MIN_SCIENCE_VERSION = Version("0.9.0") SCIENCE_REQUIREMENT = SpecifierSet("~={min_version}".format(min_version=MIN_SCIENCE_VERSION)) @@ -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) @@ -367,6 +367,8 @@ def _ensure_science( shutil.copy(path_science, target_science) if not os.path.exists(target_science): fetcher = url_fetcher or URLFetcher() + url = science_binary or _science_binary_url() + TRACER.log("Fetching science binary from {url}...".format(url=url)) with open(target_science, "wb") as write_fp, fetcher.get_body_stream( science_binary or _science_binary_url() ) as read_fp: diff --git a/scripts/build-docs.py b/scripts/build-docs.py index 4b867e9b9..640e1f571 100644 --- a/scripts/build-docs.py +++ b/scripts/build-docs.py @@ -53,7 +53,8 @@ def current(cls) -> Platform: return cls.Windows_x86_64 raise ValueError( - f"The current operating system / machine pair is not supported!: {system} / {machine}" + "The current operating system / machine pair is not supported for building docs!: " + f"{system} / {machine}" ) @property diff --git a/scripts/create-packages.py b/scripts/create-packages.py index f9c7a730b..ec29d54b0 100755 --- a/scripts/create-packages.py +++ b/scripts/create-packages.py @@ -18,7 +18,7 @@ from pathlib import Path, PurePath from typing import Dict, Iterator, Optional, Tuple, cast -from package.scie_config import ScieConfig +from package.scie_config import PlatformConfig, ScieConfig from pex.common import safe_mkdtemp DIST_DIR = Path("dist") @@ -62,7 +62,7 @@ def build_pex_pex( def build_pex_scies( scie_dest_dir: Path, verbosity: int = 0, env: Optional[Dict[str, str]] = None -) -> Iterator[tuple[Path, str]]: +) -> Iterator[tuple[Path, PlatformConfig]]: scie_config = ScieConfig.load() pex_requirement = f".[{','.join(scie_config.pex_extras)}]" @@ -75,24 +75,26 @@ def build_pex_scies( ) missing_platforms: list[str] = [] - platforms: list[tuple[str, Path]] = [] - for platform in scie_config.platforms: - complete_platform = PACKAGE_DIR / "complete-platforms" / f"{platform}.json" - if not complete_platform.exists(): - missing_platforms.append(platform) - else: - platforms.append((platform, complete_platform)) + platforms: list[tuple[PlatformConfig, Path]] = [] + for platform_config in scie_config.platforms: + complete_platform = PACKAGE_DIR / "complete-platforms" / f"{platform_config.name}.json" + if complete_platform.exists(): + platforms.append((platform_config, complete_platform)) + elif platform_config.required: + missing_platforms.append(platform_config.name) + if missing_platforms: missing = "\n".join( f"{index}. {missing_platform}" for index, missing_platform in enumerate(missing_platforms, start=1) ) raise SystemExit( - f"Of the {len(platforms)} expected Pex scie complete platforms, " - f"{len(missing)} {'is' if len(missing) == 1 else 'are'} missing:\n{missing}" + f"Of the {len(scie_config.platforms)} expected Pex scie complete platforms, " + f"{len(missing_platforms)} {'is' if len(missing_platforms) == 1 else 'are'} missing:\n" + f"{missing}" ) - for platform, complete_platform in platforms: + for platform_config, complete_platform in platforms: dest_dir = safe_mkdtemp() output_file = os.path.join(dest_dir, "pex") args = [ @@ -116,11 +118,11 @@ def build_pex_scies( "--scie-name-style", "platform-file-suffix", "--scie-platform", - platform, + platform_config.name, "--scie-pbs-release", - scie_config.pbs_release, + platform_config.pbs_release, "--scie-python-version", - scie_config.python_version, + platform_config.python_version, "--scie-pbs-stripped", "--scie-hash-alg", "sha256", @@ -147,7 +149,7 @@ def build_pex_scies( for artifact in artifacts: shutil.move(artifact, scie_dest_dir / os.path.basename(artifact)) - yield scie_dest_dir / scie_name, platform + yield scie_dest_dir / scie_name, platform_config def describe_rev() -> str: @@ -251,7 +253,7 @@ def main( print(f"Building Pex scies to `{scie_dest_dir}` ...") for scie, platform in build_pex_scies(scie_dest_dir, verbosity, env=env): hash_table[scie] = describe_file(scie) - print(f" Built Pex scie for {platform} at `{scie}`") + print(f" Built Pex scie for {platform.name} at `{scie}`") if markdown_hash_table_file and hash_table: with markdown_hash_table_file.open(mode="w") as fp: diff --git a/scripts/gen-scie-platform.py b/scripts/gen-scie-platform.py index cec3866bd..093a545db 100644 --- a/scripts/gen-scie-platform.py +++ b/scripts/gen-scie-platform.py @@ -7,7 +7,6 @@ import json import logging import os.path -import platform import subprocess import sys import tempfile @@ -24,7 +23,7 @@ from github import Github from github.WorkflowRun import WorkflowRun -from package.scie_config import ScieConfig +from package.scie_config import PlatformConfig, ScieConfig logger = logging.getLogger(__name__) @@ -51,19 +50,15 @@ def create_all_complete_platforms( f"https://github.com/pex-tool/pex/actions/workflows/{GEN_SCIE_PLATFORMS_WORKFLOW}" ) workflow = repo.get_workflow(GEN_SCIE_PLATFORMS_WORKFLOW) + encoded_scie_config = scie_config.encode() if not workflow.create_dispatch( - ref="main", - inputs={ - "pbs-release": scie_config.pbs_release, - "python-version": scie_config.python_version, - }, + ref="main", inputs={"encoded-scie-config": encoded_scie_config} ): raise GitHubError( dedent( f"""\ Failed to dispatch {GEN_SCIE_PLATFORMS_WORKFLOW} with parameters: - + pbs-release={scie_config.pbs_release} - + python-version={scie_config.python_version} + + encoded-scie-config={encoded_scie_config[:16]}... """ ) ) @@ -146,16 +141,16 @@ def ensure_all_complete_platforms( if complete_platforms and force: print("Force regenerating complete platform files.", file=out) else: - for platform_name in scie_config.platforms: - complete_platform_file = dest_dir / f"{platform_name}.json" + for platform in scie_config.platforms: + complete_platform_file = dest_dir / f"{platform.name}.json" if not complete_platform_file.exists(): continue with complete_platform_file.open() as fp: meta_data = json.load(fp).get("__meta_data__") if ( not meta_data - or scie_config.pbs_release != meta_data["pbs-release"] - or scie_config.python_version != meta_data["python-version"] + or platform.pbs_release != meta_data["pbs-release"] + or platform.python_version != meta_data["python-version"] ): print( "The complete platform file " @@ -205,20 +200,8 @@ def create_lock( ) -def current_platform() -> str: - system = platform.system().lower() - if system == "darwin": - system = "macos" - machine = platform.machine().lower() - if machine in ("aarch64", "arm64"): - return f"{system}-aarch64" - elif machine in ("amd64", "x86_64"): - return f"{system}-x86_64" - raise ValueError(f"Unexpected platform.machine(): {platform.machine()}") - - @contextmanager -def pex3_binary(scie_config: ScieConfig) -> Iterator[str]: +def pex3_binary(platform: PlatformConfig) -> Iterator[str]: with tempfile.TemporaryDirectory() as td: pex3 = os.path.join(td, "pex3") subprocess.run( @@ -232,9 +215,9 @@ def pex3_binary(scie_config: ScieConfig) -> Iterator[str]: "--scie", "lazy", "--scie-pbs-release", - scie_config.pbs_release, + platform.pbs_release, "--scie-python-version", - scie_config.python_version, + platform.python_version, "-o", pex3, ], @@ -243,8 +226,8 @@ def pex3_binary(scie_config: ScieConfig) -> Iterator[str]: yield pex3 -def create_complete_platform(complete_platform_file: Path, scie_config: ScieConfig) -> None: - with pex3_binary(scie_config=scie_config) as pex3: +def create_complete_platform(complete_platform_file: Path, platform: PlatformConfig) -> None: + with pex3_binary(platform=platform) as pex3: complete_platform = json.loads( subprocess.run( args=[pex3, "interpreter", "inspect", "--markers", "--tags"], @@ -258,12 +241,12 @@ def create_complete_platform(complete_platform_file: Path, scie_config: ScieConf "comment": ( "DO NOT EDIT - Generated via: `tox -e gen-scie-platform -- " "--pbs-release {pbs_release} --python-version {python_version}`.".format( - pbs_release=scie_config.pbs_release, - python_version=scie_config.python_version, + pbs_release=platform.pbs_release, + python_version=platform.python_version, ) ), - "pbs-release": scie_config.pbs_release, - "python-version": scie_config.python_version, + "pbs-release": platform.pbs_release, + "python-version": platform.python_version, } logger.info(f"Generating {complete_platform_file} using Python at:\n{path}") @@ -274,15 +257,11 @@ def create_complete_platform(complete_platform_file: Path, scie_config: ScieConf def main(out: IO[str]) -> str | int | None: - try: - plat = current_platform() - except ValueError as e: - sys.exit((str(e))) - parser = argparse.ArgumentParser() parser.add_argument("-d", "--dest-dir", type=Path, default=PACKAGE_DIR / "complete-platforms") parser.add_argument("--pbs-release") parser.add_argument("--python-version") + parser.add_argument("--encoded-scie-config") parser.add_argument("--all", action="store_true") parser.add_argument("-f", "--force", action="store_true") parser.add_argument("--lock-file", type=Path, default=PACKAGE_DIR / "pex-scie.lock") @@ -294,7 +273,9 @@ def main(out: IO[str]) -> str | int | None: return str(e) scie_config = ScieConfig.load( - pbs_release=options.pbs_release, python_version=options.python_version + pbs_release=options.pbs_release, + python_version=options.python_version, + encoded_config=options.encoded_scie_config, ) logging.basicConfig(level=logging.INFO if options.verbose else logging.WARNING) @@ -316,10 +297,11 @@ def main(out: IO[str]) -> str | int | None: ) as e: return str(e) else: - complete_platform_file = options.dest_dir / f"{plat}.json" + current_platform = scie_config.current_platform() + complete_platform_file = options.dest_dir / f"{current_platform.name}.json" try: create_complete_platform( - complete_platform_file=complete_platform_file, scie_config=scie_config + complete_platform_file=complete_platform_file, platform=current_platform ) except subprocess.CalledProcessError as e: return str(e) diff --git a/testing/__init__.py b/testing/__init__.py index b9be3f12a..172a8dad9 100644 --- a/testing/__init__.py +++ b/testing/__init__.py @@ -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 diff --git a/tests/integration/scie/test_pex_scie.py b/tests/integration/scie/test_pex_scie.py index 0045ca18d..c8df3dc4f 100644 --- a/tests/integration/scie/test_pex_scie.py +++ b/tests/integration/scie/test_pex_scie.py @@ -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", @@ -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", @@ -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( @@ -298,7 +302,7 @@ def test_specified_science_binary(tmpdir): local_science_binary = os.path.join(str(tmpdir), "science") with open(local_science_binary, "wb") as write_fp, URLFetcher().get_body_stream( - "https://github.com/a-scie/lift/releases/download/v0.8.0/{binary}".format( + "https://github.com/a-scie/lift/releases/download/v0.9.0/{binary}".format( binary=SciePlatform.CURRENT.qualified_binary_name("science") ) ) as read_fp: @@ -342,7 +346,7 @@ def test_specified_science_binary(tmpdir): cached_science_binaries ), "Expected the local science binary to be used but not cached." assert ( - "0.8.0" + "0.9.0" == subprocess.check_output(args=[local_science_binary, "--version"]).decode("utf-8").strip() ) @@ -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", ) } @@ -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: diff --git a/tests/test_pep_508.py b/tests/test_pep_508.py index 38a4caea6..afb0b5da5 100644 --- a/tests/test_pep_508.py +++ b/tests/test_pep_508.py @@ -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") diff --git a/tox.ini b/tox.ini index 9b83d27e2..e2a15bf6d 100644 --- a/tox.ini +++ b/tox.ini @@ -219,8 +219,12 @@ deps = httpx==0.23.0 toml==0.10.2 PyGithub==2.4.0 + # Pinned, so we get a pre-built wheel from piwheels. + cryptography==43.0.3 setenv = PYTHONPATH = {env:PYTHONPATH:}{:}{toxinidir} + # Used to get wheels for armv7l. + PIP_EXTRA_INDEX_URL = https://www.piwheels.org/simple commands = python scripts/gen-scie-platform.py {posargs}