diff --git a/CHANGELOG.md b/CHANGELOG.md index 203cc55b1a..8a62ab7840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,11 +52,11 @@ Unreleased changes template. {#v0-0-0-changed} ### Changed -* Nothing changed. +* (deps) platforms 0.0.4 -> 0.0.11 {#v0-0-0-fixed} ### Fixed -* Nothing fixed. +* (pypi) The `ppc64le` is now pointing to the right target in the `platforms` package. {#v0-0-0-added} ### Added diff --git a/MODULE.bazel b/MODULE.bazel index 76710e4ac4..3d7c3042a5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,7 +7,7 @@ module( bazel_dep(name = "bazel_features", version = "1.21.0") bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "rules_cc", version = "0.0.16") -bazel_dep(name = "platforms", version = "0.0.4") +bazel_dep(name = "platforms", version = "0.0.11") # Those are loaded only when using py_proto_library # Use py_proto_library directly from protobuf repository diff --git a/python/private/pypi/whl_installer/platform.py b/python/private/pypi/whl_installer/platform.py index 83e42b0e46..11dd6e37ab 100644 --- a/python/private/pypi/whl_installer/platform.py +++ b/python/private/pypi/whl_installer/platform.py @@ -42,14 +42,14 @@ class Arch(Enum): x86_32 = 2 aarch64 = 3 ppc = 4 - s390x = 5 - arm = 6 + ppc64le = 5 + s390x = 6 + arm = 7 amd64 = x86_64 arm64 = aarch64 i386 = x86_32 i686 = x86_32 x86 = x86_32 - ppc64le = ppc @classmethod def interpreter(cls) -> "Arch": @@ -271,6 +271,8 @@ def platform_machine(self) -> str: return "arm64" elif self.os != OS.linux: return "" + elif self.arch == Arch.ppc: + return "ppc" elif self.arch == Arch.ppc64le: return "ppc64le" elif self.arch == Arch.s390x: diff --git a/python/private/pypi/whl_target_platforms.bzl b/python/private/pypi/whl_target_platforms.bzl index 6823199bee..9f47e625b3 100644 --- a/python/private/pypi/whl_target_platforms.bzl +++ b/python/private/pypi/whl_target_platforms.bzl @@ -31,7 +31,7 @@ _CPU_ALIASES = { "arm64": "aarch64", "ppc": "ppc", "ppc64": "ppc", - "ppc64le": "ppc", + "ppc64le": "ppc64le", "s390x": "s390x", "arm": "arm", "armv6l": "arm", diff --git a/python/private/repo_utils.bzl b/python/private/repo_utils.bzl index e5c78be815..d9ad2449f1 100644 --- a/python/private/repo_utils.bzl +++ b/python/private/repo_utils.bzl @@ -391,8 +391,10 @@ def _get_platforms_cpu_name(mrctx): return "x86_32" if arch in ["amd64", "x86_64", "x64"]: return "x86_64" - if arch in ["ppc", "ppc64", "ppc64le"]: + if arch in ["ppc", "ppc64"]: return "ppc" + if arch in ["ppc64le"]: + return "ppc64le" if arch in ["arm", "armv7l"]: return "arm" if arch in ["aarch64"]: diff --git a/tests/config_settings/construct_config_settings_tests.bzl b/tests/config_settings/construct_config_settings_tests.bzl index 087efbbc70..1d21a8680d 100644 --- a/tests/config_settings/construct_config_settings_tests.bzl +++ b/tests/config_settings/construct_config_settings_tests.bzl @@ -47,7 +47,7 @@ def _test_minor_version_matching(name): } minor_cpu_matches = { str(Label(":is_python_3.11_aarch64")): "matched-3.11-aarch64", - str(Label(":is_python_3.11_ppc")): "matched-3.11-ppc", + str(Label(":is_python_3.11_ppc64le")): "matched-3.11-ppc64le", str(Label(":is_python_3.11_s390x")): "matched-3.11-s390x", str(Label(":is_python_3.11_x86_64")): "matched-3.11-x86_64", } @@ -58,7 +58,7 @@ def _test_minor_version_matching(name): } minor_os_cpu_matches = { str(Label(":is_python_3.11_linux_aarch64")): "matched-3.11-linux-aarch64", - str(Label(":is_python_3.11_linux_ppc")): "matched-3.11-linux-ppc", + str(Label(":is_python_3.11_linux_ppc64le")): "matched-3.11-linux-ppc64le", str(Label(":is_python_3.11_linux_s390x")): "matched-3.11-linux-s390x", str(Label(":is_python_3.11_linux_x86_64")): "matched-3.11-linux-x86_64", str(Label(":is_python_3.11_osx_aarch64")): "matched-3.11-osx-aarch64", @@ -171,7 +171,7 @@ def construct_config_settings_test_suite(name): # buildifier: disable=function- }, ) - for cpu in ["s390x", "ppc", "x86_64", "aarch64"]: + for cpu in ["s390x", "ppc", "ppc64le", "x86_64", "aarch64"]: native.config_setting( name = "is_python_3.11_" + cpu, constraint_values = [ @@ -185,6 +185,7 @@ def construct_config_settings_test_suite(name): # buildifier: disable=function- for (os, cpu) in [ ("linux", "aarch64"), ("linux", "ppc"), + ("linux", "ppc64le"), ("linux", "s390x"), ("linux", "x86_64"), ("osx", "aarch64"), diff --git a/tests/pypi/whl_installer/platform_test.py b/tests/pypi/whl_installer/platform_test.py index 7ced1e9826..2aeb4caa69 100644 --- a/tests/pypi/whl_installer/platform_test.py +++ b/tests/pypi/whl_installer/platform_test.py @@ -34,17 +34,17 @@ def test_can_get_specific_from_string(self): def test_can_get_all_for_py_version(self): cp39 = Platform.all(minor_version=9) - self.assertEqual(18, len(cp39), f"Got {cp39}") + self.assertEqual(21, len(cp39), f"Got {cp39}") self.assertEqual(cp39, Platform.from_string("cp39_*")) def test_can_get_all_for_os(self): linuxes = Platform.all(OS.linux, minor_version=9) - self.assertEqual(6, len(linuxes)) + self.assertEqual(7, len(linuxes)) self.assertEqual(linuxes, Platform.from_string("cp39_linux_*")) def test_can_get_all_for_os_for_host_python(self): linuxes = Platform.all(OS.linux) - self.assertEqual(6, len(linuxes)) + self.assertEqual(7, len(linuxes)) self.assertEqual(linuxes, Platform.from_string("linux_*")) def test_specific_version_specializations(self): @@ -84,6 +84,7 @@ def test_linux_specializations(self): Platform(os=OS.linux, arch=Arch.x86_32), Platform(os=OS.linux, arch=Arch.aarch64), Platform(os=OS.linux, arch=Arch.ppc), + Platform(os=OS.linux, arch=Arch.ppc64le), Platform(os=OS.linux, arch=Arch.s390x), Platform(os=OS.linux, arch=Arch.arm), ] @@ -101,6 +102,7 @@ def test_osx_specializations(self): Platform(os=OS.osx, arch=Arch.x86_32), Platform(os=OS.osx, arch=Arch.aarch64), Platform(os=OS.osx, arch=Arch.ppc), + Platform(os=OS.osx, arch=Arch.ppc64le), Platform(os=OS.osx, arch=Arch.s390x), Platform(os=OS.osx, arch=Arch.arm), ] diff --git a/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl b/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl index ba04e1d887..a042ed0346 100644 --- a/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl +++ b/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl @@ -68,7 +68,7 @@ def _test_platforms(env): "@//python/config_settings:is_python_3.9": ["py39_dep"], "@platforms//cpu:aarch64": ["arm_dep"], "@platforms//os:windows": ["win_dep"], - "cp310_linux_ppc": ["py310_linux_ppc_dep"], + "cp310_linux_ppc64le": ["py310_linux_ppc64le_dep"], "cp39_anyos_aarch64": ["py39_arm_dep"], "cp39_linux_anyarch": ["py39_linux_dep"], "linux_x86_64": ["linux_intel_dep"], @@ -82,12 +82,12 @@ def _test_platforms(env): env.expect.that_collection(calls).contains_exactly([ { - "name": "is_python_3.10_linux_ppc", + "name": "is_python_3.10_linux_ppc64le", "flag_values": { "@rules_python//python/config_settings:python_version_major_minor": "3.10", }, "constraint_values": [ - "@platforms//cpu:ppc", + "@platforms//cpu:ppc64le", "@platforms//os:linux", ], "visibility": ["//visibility:private"], @@ -195,7 +195,7 @@ def _test_whl_and_library_deps(env): "@//python/config_settings:is_python_3.9": ["py39_dep"], "@platforms//cpu:aarch64": ["arm_dep"], "@platforms//os:windows": ["win_dep"], - "cp310_linux_ppc": ["py310_linux_ppc_dep"], + "cp310_linux_ppc64le": ["py310_linux_ppc64le_dep"], "cp39_anyos_aarch64": ["py39_arm_dep"], "cp39_linux_anyarch": ["py39_linux_dep"], "linux_x86_64": ["linux_intel_dep"], @@ -227,7 +227,7 @@ def _test_whl_and_library_deps(env): Label("//python/config_settings:is_python_3.9"): ["@pypi_py39_dep//:whl"], "@platforms//cpu:aarch64": ["@pypi_arm_dep//:whl"], "@platforms//os:windows": ["@pypi_win_dep//:whl"], - ":is_python_3.10_linux_ppc": ["@pypi_py310_linux_ppc_dep//:whl"], + ":is_python_3.10_linux_ppc64le": ["@pypi_py310_linux_ppc64le_dep//:whl"], ":is_python_3.9_anyos_aarch64": ["@pypi_py39_arm_dep//:whl"], ":is_python_3.9_linux_anyarch": ["@pypi_py39_linux_dep//:whl"], ":is_linux_x86_64": ["@pypi_linux_intel_dep//:whl"], @@ -264,7 +264,7 @@ def _test_whl_and_library_deps(env): Label("//python/config_settings:is_python_3.9"): ["@pypi_py39_dep//:pkg"], "@platforms//cpu:aarch64": ["@pypi_arm_dep//:pkg"], "@platforms//os:windows": ["@pypi_win_dep//:pkg"], - ":is_python_3.10_linux_ppc": ["@pypi_py310_linux_ppc_dep//:pkg"], + ":is_python_3.10_linux_ppc64le": ["@pypi_py310_linux_ppc64le_dep//:pkg"], ":is_python_3.9_anyos_aarch64": ["@pypi_py39_arm_dep//:pkg"], ":is_python_3.9_linux_anyarch": ["@pypi_py39_linux_dep//:pkg"], ":is_linux_x86_64": ["@pypi_linux_intel_dep//:pkg"], diff --git a/tests/pypi/whl_target_platforms/whl_target_platforms_tests.bzl b/tests/pypi/whl_target_platforms/whl_target_platforms_tests.bzl index a72bdc275f..a976a0cf95 100644 --- a/tests/pypi/whl_target_platforms/whl_target_platforms_tests.bzl +++ b/tests/pypi/whl_target_platforms/whl_target_platforms_tests.bzl @@ -32,7 +32,7 @@ def _test_simple(env): struct(os = "linux", cpu = "x86_32", abi = None, target_platform = "linux_x86_32", version = (2, 17)), ], "musllinux_1_1_ppc64le": [ - struct(os = "linux", cpu = "ppc", abi = None, target_platform = "linux_ppc", version = (1, 1)), + struct(os = "linux", cpu = "ppc64le", abi = None, target_platform = "linux_ppc64le", version = (1, 1)), ], "win_amd64": [ struct(os = "windows", cpu = "x86_64", abi = None, target_platform = "windows_x86_64", version = (0, 0)), @@ -60,9 +60,12 @@ def _test_with_abi(env): "manylinux1_i686.manylinux_2_17_i686": [ struct(os = "linux", cpu = "x86_32", abi = "cp38", target_platform = "cp38_linux_x86_32", version = (0, 0)), ], - "musllinux_1_1_ppc64le": [ + "musllinux_1_1_ppc64": [ struct(os = "linux", cpu = "ppc", abi = "cp311", target_platform = "cp311_linux_ppc", version = (1, 1)), ], + "musllinux_1_1_ppc64le": [ + struct(os = "linux", cpu = "ppc64le", abi = "cp311", target_platform = "cp311_linux_ppc64le", version = (1, 1)), + ], "win_amd64": [ struct(os = "windows", cpu = "x86_64", abi = "cp311", target_platform = "cp311_windows_x86_64", version = (0, 0)), ],