-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
type: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
Description
pip install
adds the target interpreter’s path to script shebangs both for scripts defined via entry points and for scripts in (data)/scripts
(i.e. the wheel path pkg_name-1.2.2.data/scripts/
).
However for the latter, it uses more brittle code to create the shebang.
So this:
pip/src/pip/_internal/operations/install/wheel.py
Lines 96 to 97 in 3f5ac79
exename = sys.executable.encode(sys.getfilesystemencoding()) | |
firstline = b"#!" + exename + os.linesep.encode("ascii") |
should be changed to use this code:
pip/src/pip/_vendor/distlib/scripts.py
Line 183 in 3f5ac79
def _get_shebang(self, encoding, post_interp=b'', options=None): |
See: ranger/ranger#2941 (comment)
See also:
- Wheel scripts don't get command line wrappers on Windows #2596
- More robust shebang manipulation #12599
- Use PIPX_HOME as given pipx#1327
Expected behavior
Shebang is correctly modified
pip version
25.0.1
Python version
3.13
OS
Linux/MacOS
How to Reproduce & Output
$ mkdir "path with spaces"
$ cd "path with spaces"
$ python -m venv .venv
$ .venv/bin/pip install ranger-fm==1.9.4
$ head -n1 .venv/bin/ranger
#!/home/me/path with spaces/.venv/bin/python
$ .venv/bin/ranger
zsh:1: .venv/bin/ranger: bad interpreter: /home/me/path: no such file or directory
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Gitznik
Metadata
Metadata
Assignees
Labels
type: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior