Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Unreleased changes template.
* (rules) deprecation warnings for deprecated symbols have been turned off by
default for now and can be enabled with `RULES_PYTHON_DEPRECATION_WARNINGS`
env var.
* (deps) platforms 0.0.4 -> 0.0.11
* (pypi) Downgraded versions of packages: `pip` from `24.3.2` to `24.0.0` and
`packaging` from `24.2` to `24.0`.

Expand All @@ -94,6 +95,7 @@ Unreleased changes template.
* (gazelle) Providing multiple input requirements files to `gazelle_python_manifest` now works correctly.
* (pypi) Handle trailing slashes in pip index URLs in environment variables,
fixes [#2554](https://github.com/bazelbuild/rules_python/issues/2554).
* (pypi) The `ppc64le` is now pointing to the right target in the `platforms` package.
* (runfiles) Runfile manifest and repository mapping files are now interpreted
as UTF-8 on all platforms.
* (coverage) Coverage with `--bootstrap_impl=script` is fixed
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions python/private/pypi/whl_installer/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion python/private/pypi/whl_target_platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _CPU_ALIASES = {
"arm64": "aarch64",
"ppc": "ppc",
"ppc64": "ppc",
"ppc64le": "ppc",
"ppc64le": "ppc64le",
"s390x": "s390x",
"arm": "arm",
"armv6l": "arm",
Expand Down
4 changes: 3 additions & 1 deletion python/private/repo_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
7 changes: 4 additions & 3 deletions tests/config_settings/construct_config_settings_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand All @@ -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",
Expand Down Expand Up @@ -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 = [
Expand All @@ -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"),
Expand Down
8 changes: 5 additions & 3 deletions tests/pypi/whl_installer/platform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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),
]
Expand All @@ -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),
]
Expand Down
12 changes: 6 additions & 6 deletions tests/pypi/whl_library_targets/whl_library_targets_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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)),
],
Expand Down
Loading