Skip to content
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

scripts are set to "funny" paths #18

Open
vanrein opened this issue Mar 14, 2019 · 2 comments
Open

scripts are set to "funny" paths #18

vanrein opened this issue Mar 14, 2019 · 2 comments

Comments

@vanrein
Copy link

vanrein commented Mar 14, 2019

After building a few wheels with python setup.py and again with pip wheel as in these demo scripts, I found that executable scripts are "cleverly" manipulated on their first line which is set to things like

#!/opt/python/cp27-cp27m/bin/python

This is indeed documented, but the proposed work-around with --executable is not. The original actually said #!/usr/bin/env python which is more portable than what is put in this line...

It is wrong, anyway. If the first line is replaced, then this should not be done with the building platform's hash-bang, but with the target platform's. When I installed one of the wheels from PyPi on another system, this path was indeed still being used (but Python not found there, of course).

Not sure if this is a problem in your code or in setuptools, because the latter lacks in documentation. I'm effectively stuck publishing my packages due to this, so any advise is welcome.

You can see my setup.py if you want.

@njsmith
Copy link
Member

njsmith commented Mar 14, 2019

IIUC there are supposed to be two options for putting scripts in wheels:

  • You can use the console_scripts entrypoint method, and then when your wheel is installed pip will automatically generate appropriate script wrappers with the right Python version. This is the approach most people use and recommend.

  • You can include scripts in your wheel with a magic #!python line, and then when pip installs them it should rewrite that line to point to whatever python was used to install the wheel (ref). This is the less common approach, so I don't know how well it's supported in practice – I've never tried it. I thought maybe using the setuptools scripts= option would end up putting these kind of scripts into your wheel, but I don't know... that's a question for setuptools really. (And I don't understand how it can work on Windows at all, which doesn't have #! lines...)

I'd suggest asking in either the setuptools or the packaging-problems trackers, a lot more people look at those than this one.

@vanrein
Copy link
Author

vanrein commented Mar 15, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants