Commit c43ab14
committed
bpo-31046: Fix ensurepip script shebangs with --root
When using `python -m ensurepip` with the `--root` option for staged
installations, the generated pip script contained an incorrect shebang
that pointed into the staging directory. This made the installation
unusable once the staging directory was removed.
This commit fixes the issue by using the internal pip `--executable`
option to force the shebang to point to the correct, final
interpreter path.
It also corrects related pathing issues:
- Removes the check that incorrectly disallowed using --root and
--prefix together.
- Defaults the installation prefix to `/` when --root is used alone,
ensuring installation occurs at the base of the staging directory.
References: #17634 (comment)
Signed-off-by: Matěj Cepl <mcepl@cepl.eu>1 parent 01d546e commit c43ab14
1 file changed
+27
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | 133 | | |
136 | 134 | | |
137 | 135 | | |
| |||
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 163 | | |
170 | 164 | | |
171 | | - | |
172 | | - | |
173 | 165 | | |
174 | 166 | | |
175 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
176 | 195 | | |
177 | 196 | | |
178 | 197 | | |
| |||
0 commit comments