From 6daa9df9f60f9d7d1780421be21a5d12c3d5117f Mon Sep 17 00:00:00 2001 From: Sebastian Birunt Date: Tue, 6 May 2025 15:01:26 +0200 Subject: [PATCH] fix: pip spoke whl repository platform Having: ```py pip.parse( hub_name = "pre-commit-hook-{}".format(version), python_version = version, requirements_lock = "//pre-commit/hook/requirements:lock.txt", ), ``` and using `requirements_lock` attribute will create pip spoke whl repositories just for the host platform. This can have potential issues when the repository is platform dependent and the host platform is different of execution platform (common case for RBE build). The change sets pip requirements for different platforms separately. Specifying platforms as: - `"linux_*"` - `"osx_*"` - `"windows_*"` allows the pip to create repositories for different platforms and picks up correct one for the execution platform. --- MODULE.bazel | 4 +++- MODULE.bazel.lock | 2 +- e2e/MODULE.bazel.lock | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index cbe23af..eceb4c8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -39,7 +39,9 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( hub_name = "pre-commit-hook-{}".format(version), python_version = version, - requirements_lock = "//pre-commit/hook/requirements:lock.txt", + requirements_by_platform = { + "//pre-commit/hook/requirements:lock.txt": "linux_*,osx_*,windows_*", + }, ), pip.parse( hub_name = "pre-commit-config-{}".format(version), diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index c4dbe41..c2bbdc8 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -657,7 +657,7 @@ "@@rules_python+//python/extensions:pip.bzl%pip": { "general": { "bzlTransitiveDigest": "2ZGbLzEhJiYeTL/HLcIGGr/4T4YIvqiLTBDeEGjVdFE=", - "usagesDigest": "BwyoDpM5TvSwIVe79Mj0fxoCjrWraWlVFlU+rgvY9Tc=", + "usagesDigest": "W57LKisFRiQzgUmpgZKHAalEaeUuwMEXDCCVE143zwo=", "recordedFileInputs": { "@@//pre-commit/config/requirements/lock.txt": "c4df528d05090e2268c3f64b30c016de5175939606c1ebc14088f888f5d93dd0", "@@//pre-commit/hook/requirements/lock.txt": "5f20fd61af75464158a62d2d3739cefca20d6963130c6cb37e345bcfef567424", diff --git a/e2e/MODULE.bazel.lock b/e2e/MODULE.bazel.lock index 66bb52d..9adafcb 100644 --- a/e2e/MODULE.bazel.lock +++ b/e2e/MODULE.bazel.lock @@ -407,7 +407,7 @@ "@@rules_python+//python/extensions:pip.bzl%pip": { "general": { "bzlTransitiveDigest": "5c6OlhUxy0VyL+VUCux9qubrei54dI8Ec5rUrxouxjY=", - "usagesDigest": "xhNTdh9Me7P3fcYm2OZC3bO+nzvZxW5TvkUj8vTVXTo=", + "usagesDigest": "eOqqEFYNziwPYX2Xh5Ah4vs9sI00GnhbFJLwKhGq3M0=", "recordedFileInputs": { "@@pre-commit+//pre-commit/config/requirements/lock.txt": "c4df528d05090e2268c3f64b30c016de5175939606c1ebc14088f888f5d93dd0", "@@pre-commit+//pre-commit/hook/requirements/lock.txt": "5f20fd61af75464158a62d2d3739cefca20d6963130c6cb37e345bcfef567424", -- GitLab