I have a Python package with a script with the shebang #!/usr/bin/env python
. After I build a wheel of this package, I inspect the script inside the .whl and the new shebang is #!/path/to/some/virtualenv/bin/python
. It's the path to a virtualenv which is not even the one active when I build the wheel.
> which python
#!/path/to/active/virtualenv/bin/python
> which wheel
#!/path/to/active/virtualenv/bin/wheel
This breaks distribution of my package. How can I fix this?
Split process into 2 phases:
python setup.py build --executable '/usr/bin/env python' &&
python setup.py bdist_wheel [--universal]
build
command creates build/
subdirectory; when a bdist_*
command (bdist_egg
or bdist_wheel
) detects the existence of the subdirectory it doesn't run build
command but uses whatever build
put in build/
.
I use the approach in all my release scripts. Two examples: Cheetah, SQLObject.