-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip wheel install scripts not respecting parameters after #!python
#10661
Comments
The wheel specification says
The problem is how you interpret “rewrite to point to the correct interpreter”. pip currently replaces the entire shebang line, which is arguably wrong. A more sensible approach would be to split by first (Note that this approach is not guaranteed to work because spaces in shebang is very poorly specified without any way to produce a universally protable solution. But that is also a problem with the current implementation as well, and splitting by the first space at least would not break currently-working scenarios.) |
@uranusjr Thanks for the explanation. I wasn't quite sure whether it was a bug or whether it was the intended behaviour, but I would support splitting the string by the first space and replacing the first part... This seems to be what the build_scripts class in |
Would you be interested in submitting a pull request fixing this? |
Also @pradyunsg since we’d probably want to make sure |
... and maybe update the wheel spec to be clearer on the intended interpretation. |
That. :) |
https://github.com/pradyunsg/installer/blob/05e94397e90dc4aff6f1cabb130ee84fe2535982/src/installer/utils.py#L160 -- yup, installer needs updating too! |
Sure... I've create one now - I hope it's ok. |
Description
I'm not sure if this is a bug or if it's the desired behaviour (I couldn't find any docs on it), but if I create a script with an argument after the interpreter in the shebang, e.g.
#!python -i
the argument is ignored / missed out when the wheel is installed and thepython
string is replaced by the real python executable.This doesn't happen if I install it as an egg.
Expected behavior
I expected that arguments in the shebang line are retained, and the behaviour in eggs and wheels are the same.
pip version
21.3.1
Python version
3.7
OS
Windows 10
How to Reproduce
My setup to reproduce this has the following structure:
scripts/interactive_script.py
is:mypackage/__init__.py
is:setup.py
is:So, I expect that when I run
interactive_script.py
it would print the two lines and then go into a Python prompt. This is what happens when I dopython setup.py install
and install anegg
.But if I do
python setup.py bdist_wheel
orpip wheel .
and then install the wheel, it just prints the two lines and exits.Output
Code of Conduct
The text was updated successfully, but these errors were encountered: