You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add runfiles root for system_python bootstrap (#3423)
When the system_bootstrap code was changed to using the site init for
adding to sys.path,
importing `bazel_tools.tools.python.runfiles` stopped working. This is
because the
runfiles root was no longer being added to sys.path.
This is somewhat WAI because:
1. Always adding the runfiles root to sys.path is a deprecated legacy
behavior because
it can interfere with Python imports (a repo name can mask a legitimate
import).
2. Under bzlmod, repo directory names aren't importable Python names, so
having the
runfiles root on sys.path doesn't do much.
An exception to (2) is bazel_tools: this is special cased to use the
directory
name `bazel_tools` in runfiles. This is where the legacy runfiles
library for
Python is.
In any case, forgetting the runfiles root on sys.path for the
system_python bootstrap
was an oversight, as the intention was to be a more no-op refactoring.
Fixes#3422
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* (gazelle) Fix `gazelle_python_manifest.test` so that it accesses manifest files via `runfile` path handling rather than directly ([#3397](https://github.com/bazel-contrib/rules_python/issues/3397)).
94
-
94
+
* (core rules) For the system_python bootstrap, the runfiles root is added to
0 commit comments