From 3054be1d04e754987f6434ef2ea5bb57c711b559 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 17:57:41 +0000 Subject: [PATCH 1/4] Update dependency rules_python to v1.8.4 --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index c412209e..e829e688 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -32,7 +32,7 @@ bazel_dep(name = "protobuf", version = "33.5") # Development-only module dependencies bazel_dep(name = "stardoc", version = "0.8.1", dev_dependency = True) bazel_dep(name = "rules_go", version = "0.60.0", dev_dependency = True) -bazel_dep(name = "rules_python", version = "1.7.0", dev_dependency = True) +bazel_dep(name = "rules_python", version = "1.8.4", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.47.0", dev_dependency = True) bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.9.0", dev_dependency = True) bazel_dep(name = "bazel_features", version = "1.41.0", dev_dependency = True) From 7c19e64b0c9140761aef6eeacb982c2601a826c0 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Wed, 18 Feb 2026 16:49:03 +0100 Subject: [PATCH 2/4] Roll back https://github.com/bazel-contrib/rules_python/pull/3086 locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We haven’t isolated https://github.com/bazel-contrib/rules_python/pull/3086#issuecomment-3765803662 yet, and https://github.com/bazel-contrib/rules_python/issues/3579 appears to be a separate issue, so it’s better to get back to a known-good state to unblock rules_python updates. --- MODULE.bazel | 8 +++- rules_python.patch | 104 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 rules_python.patch diff --git a/MODULE.bazel b/MODULE.bazel index e829e688..63f773d1 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,4 +1,4 @@ -# Copyright 2023-2025 Google LLC +# Copyright 2023-2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,6 +43,12 @@ bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True) cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") use_repo(cc_configure, "local_config_cc", "local_config_cc_toolchains") +single_version_override( + module_name = "rules_python", + patch_strip = 1, + patches = ["rules_python.patch"], +) + # Non-module dependencies emacs_repository = use_repo_rule("//elisp/private:emacs_repository.bzl", "emacs_repository") diff --git a/rules_python.patch b/rules_python.patch new file mode 100644 index 00000000..91b032f0 --- /dev/null +++ b/rules_python.patch @@ -0,0 +1,104 @@ +From c61f3cc8251abef63646587630203a024a1bd575 Mon Sep 17 00:00:00 2001 +From: Joel Sing +Date: Mon, 14 Jul 2025 14:15:41 +1000 +Subject: [PATCH 1/5] fix(runfiles): correct Python runfiles path assumption + +The current _FindPythonRunfilesRoot() implementation assumes that +the Python module has been unpacked four levels below the runfiles +directory. This is not the case in multiple situations, for example when +rules_pycross is in use and has installed the module via pypi (in which +case it is five levels below runfiles). + +Both strategies already know where the runfiles directory exists - +implement _GetRunfilesDir() on the _DirectoryBased strategy, then call +_GetRunfilesDir() in order to populate self._python_runfiles_dir. + +Stop passing a bogus path to runfiles.Create() in testCurrentRepository(), +such that the test actually uses the appropriate runfiles path. + +Fixes #3085 +--- + CHANGELOG.md | 4 ++++ + python/runfiles/runfiles.py | 17 ++++------------- + tests/runfiles/runfiles_test.py | 2 +- + 3 files changed, 9 insertions(+), 14 deletions(-) + +diff --git a/python/runfiles/runfiles.py b/python/runfiles/runfiles.py +index fc794272c9..bfa9d0d053 100644 +--- b/python/runfiles/runfiles.py ++++ a/python/runfiles/runfiles.py +@@ -229,9 +229,6 @@ + # runfiles strategy on those platforms. + return posixpath.join(self._runfiles_root, path) + +- def _GetRunfilesDir(self) -> str: +- return self._runfiles_root +- + def EnvVars(self) -> Dict[str, str]: + return { + "RUNFILES_DIR": self._runfiles_root, +@@ -249,7 +246,7 @@ + + def __init__(self, strategy: Union[_ManifestBased, _DirectoryBased]) -> None: + self._strategy = strategy +- self._python_runfiles_root = strategy._GetRunfilesDir() ++ self._python_runfiles_root = _FindPythonRunfilesRoot() + self._repo_mapping = _RepositoryMapping.create_from_file( + strategy.RlocationChecked("_repo_mapping") + ) +@@ -472,6 +469,18 @@ + _Runfiles = Runfiles + + ++def _FindPythonRunfilesRoot() -> str: ++ """Finds the root of the Python runfiles tree.""" ++ root = __file__ ++ # Walk up our own runfiles path to the root of the runfiles tree from which ++ # the current file is being run. This path coincides with what the Bazel ++ # Python stub sets up as sys.path[0]. Since that entry can be changed at ++ # runtime, we rederive it here. ++ for _ in range("rules_python/python/runfiles/runfiles.py".count("/") + 1): ++ root = os.path.dirname(root) ++ return root ++ ++ + def CreateManifestBased(manifest_path: str) -> Runfiles: + return Runfiles.CreateManifestBased(manifest_path) + +From d86b9e943b1cd2db4387843c1b72531301ea5fc1 Mon Sep 17 00:00:00 2001 +From: Joel Sing +Date: Thu, 23 Oct 2025 13:29:45 +1100 +Subject: [PATCH 2/5] Add test that ensures we can correctly locate and open a + data file. + +--- + tests/runfiles/BUILD.bazel | 3 +++ + tests/runfiles/runfiles_test.py | 10 ++++++++++ + 2 files changed, 13 insertions(+) + +From d63226877520b20a0aa4dd10f040a316975f7773 Mon Sep 17 00:00:00 2001 +From: Joel Sing +Date: Thu, 23 Oct 2025 13:30:08 +1100 +Subject: [PATCH 3/5] Add workaround for buggy zip file bootstrap. + +--- + .../runtime_env_toolchain/toolchain_runs_test.py | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +From 6166d66a3672648fd9178d2031c9030922b2026e Mon Sep 17 00:00:00 2001 +From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> +Date: Wed, 5 Nov 2025 17:47:58 +0900 +Subject: [PATCH 4/5] doc: move changelog to the unreleased section. + +--- + CHANGELOG.md | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +From 7e48c4e89f233ef43f15b993ceafc12e90ae0e40 Mon Sep 17 00:00:00 2001 +From: Joel Sing +Date: Thu, 6 Nov 2025 14:15:02 +1100 +Subject: [PATCH 5/5] Appease mypy + +--- + tests/runfiles/runfiles_test.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) From 54df7cffffc18f7539a1ed8b4d6e77c81f8371ec Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Wed, 18 Feb 2026 16:53:04 +0100 Subject: [PATCH 3/4] Update Bazel lockfile --- MODULE.bazel.lock | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index bb203068..c4446c89 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -220,7 +220,8 @@ "https://bcr.bazel.build/modules/rules_python/1.6.0/MODULE.bazel": "7e04ad8f8d5bea40451cf80b1bd8262552aa73f841415d20db96b7241bd027d8", "https://bcr.bazel.build/modules/rules_python/1.6.3/MODULE.bazel": "a7b80c42cb3de5ee2a5fa1abc119684593704fcd2fec83165ebe615dec76574f", "https://bcr.bazel.build/modules/rules_python/1.7.0/MODULE.bazel": "d01f995ecd137abf30238ad9ce97f8fc3ac57289c8b24bd0bf53324d937a14f8", - "https://bcr.bazel.build/modules/rules_python/1.7.0/source.json": "028a084b65dcf8f4dc4f82f8778dbe65df133f234b316828a82e060d81bdce32", + "https://bcr.bazel.build/modules/rules_python/1.8.4/MODULE.bazel": "33e3971e66161a3e955f7a0d411a8d1f291c4ce4c561851512466f3c77ff8ece", + "https://bcr.bazel.build/modules/rules_python/1.8.4/source.json": "9fbc0e57bae52cddcc3831d668bce87a47e0c655104a85098d4459dd9a3b0a10", "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", "https://bcr.bazel.build/modules/rules_shell/0.6.1/MODULE.bazel": "72e76b0eea4e81611ef5452aa82b3da34caca0c8b7b5c0c9584338aa93bae26b", @@ -449,8 +450,8 @@ }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { - "bzlTransitiveDigest": "2hLgIvNVTLgxus0ZuXtleBe70intCfo0cHs8qvt6cdM=", - "usagesDigest": "ZVSXMAGpD+xzVNPuvF1IoLBkty7TROO0+akMapt1pAg=", + "bzlTransitiveDigest": "wUM/eFwo5Zy7rn36nZ9ZxN9tXhmcWMVGXIExerGg6gM=", + "usagesDigest": "p2al+dDKI5UlCyNvheMVynbWSGbdiji/jMz53fMNfJA=", "recordedInputs": [ "REPO_MAPPING:rules_python+,bazel_tools bazel_tools", "REPO_MAPPING:rules_python+,pypi__build rules_python++config+pypi__build", @@ -618,7 +619,7 @@ "@@rules_python+//python/uv:uv.bzl%uv": { "general": { "bzlTransitiveDigest": "ijW9KS7qsIY+yBVvJ+Nr1mzwQox09j13DnE3iIwaeTM=", - "usagesDigest": "H8dQoNZcoqP+Mu0tHZTi4KHATzvNkM5ePuEqoQdklIU=", + "usagesDigest": "/HRt5Hw/vpDr9CDrKEPjeDIjxo4307VLxMu8BNAEDWA=", "recordedInputs": [ "REPO_MAPPING:rules_python+,bazel_tools bazel_tools", "REPO_MAPPING:rules_python+,platforms platforms" From 40996f49b985e9a916fb632c8ec49ad664584c3b Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Wed, 18 Feb 2026 16:55:24 +0100 Subject: [PATCH 4/4] Add FIXME --- MODULE.bazel | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index 63f773d1..74f58e7f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -43,6 +43,9 @@ bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True) cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") use_repo(cc_configure, "local_config_cc", "local_config_cc_toolchains") +# FIXME: Remove rules_python.patch once +# https://github.com/bazel-contrib/rules_python/pull/3086#issuecomment-3765803662 +# is isolated and fixed. single_version_override( module_name = "rules_python", patch_strip = 1,