Commit 1b85ec8
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>1 parent 5bc7ba3 commit 1b85ec8
File tree
5 files changed
+55
-7
lines changed- python/private
- tests/bootstrap_impls
5 files changed
+55
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
| |||
508 | 511 | | |
509 | 512 | | |
510 | 513 | | |
511 | | - | |
| 514 | + | |
512 | 515 | | |
513 | 516 | | |
514 | 517 | | |
| |||
596 | 599 | | |
597 | 600 | | |
598 | 601 | | |
| 602 | + | |
599 | 603 | | |
600 | 604 | | |
601 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
| |||
147 | 144 | | |
148 | 145 | | |
149 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
150 | 158 | | |
151 | 159 | | |
152 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
107 | 119 | | |
108 | 120 | | |
109 | 121 | | |
| |||
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
124 | 139 | | |
125 | 140 | | |
126 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments