One thing I hate about distutils (I guess he is the evil who does this) is that it changes the shebang line. In other words, the more rational and environment-vars decided scripture
#!/usr/bin/env python
gets magically converted into
#!/whatever/absolute/path/is/my/python
This is seen also with grok: I used grokproject in a virtualenv to start my project, but now I cannot move the development directory around anymore, because it puts absolute paths in the shebang directive.
The reason why I ask this is twofold
Of course you can move the development directory around. Distutils changes the paths to the python that you should run with when you run it. It's in Grok run when you run the buildout. Move and re-run the bootstrap and the buildout. Done!
Distutils changes the path to the Python you use to run distutils with. If it didn't, then you might end up installing a library in one python version, but when you try to run the script it would fail, because it would run with another python version that didn't have the library.
That's not insanity, it's in fact the only sane way to do it.
Update: If you know what you are doing, you can do this:
/path/to/install/python setup.py build -e "/the/path/you/want/python" install
Make sure you clean the build directory first though. :)
Distutils will automatically replace the shebang with the location of the Python binary that was used to execute setup.py. To override this behavior you have two options:
Option 1: Manually
You may pass the flag --executable=/path/to/my/python to setup.py. Arguments are accepted.
Example:
% python setup.py build --executable=/opt/local/bin/python -d
Option 2: Automatically
Your other option is to add a line to setup.cfg. If you aren't using setup.cfg, create it in the same directory as setup.py. Setup.py looks for this on startup. Any options specified here can still be overridden with flags at the command-line.
% cat setup.cfg [build] executable = /opt/local/bin/python -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With