You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Thank you kindly, Nathaniel!
It's difficult to get into as setuptools only covers basic uses in its documentation, but you're pointing me to some corners I thought wouldn't work. If needed, I will happily follow the alternative pointers you gave.
It sounds like this is not a manylinux1-specific problem then.
Cheers,
-Rick
After building a few wheels with
python setup.py
and again withpip wheel
as in these demo scripts, I found that executable scripts are "cleverly" manipulated on their first line which is set to things likeThis 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.
The text was updated successfully, but these errors were encountered: