This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michal Cyprian
Recipients Michal Cyprian, dstufft, eric.araujo
Date 2017-02-01.10:43:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485945833.17.0.354426636585.issue29411@psf.upfronthosting.co.za>
In-reply-to
Content
1. python3 setup.py build --executable="/usr/bin/binary"
2. python3 setup.py install -O1 --skip-build

These two commands are typically used to build and install Python packages from sources. Let's assume there is a setup.py script of package foo, containing a script foo. The --executable option of build command (1) should set the shebang of the script foo to #!/usr/bin/binary. The problem is that this option doesn't work for scripts listed in setup.py as entry_points, which is the most common way of handling scripts these days.

The idea of the original design was probably to pass the value of --executable to the build_scripts command and set shebang there. However, this command is not executed if the package contains only entry_points.

The scripts listed as entry_points are processed during execution of the install command (2) (specifically, in the easy_install command), which is completely isolated from the build command (1) and doesn't have access to the value specified in the --executable option.

The only reasonable solution that came to my mind was to add the --executable option to the install command as well, pass it to the easy_install command and make the ScriptWriter class use this value.

I prepared a patch that fixes this issue in setuptools [1]. To make it work, a small patch [2] will have to be applied to distutils as well.
Would this or something similar be acceptable for distutils?

I've already sent this proposal to pypa-dev mailing list, they replied that patch will be useful. The patch [2] needs to go to distutils first, to make patch for setuptools work.


[1] https://github.com/mcyprian/python-setuptools/blob/system-python/add-executable-option.patch
[2] https://github.com/mcyprian/python-setuptools/blob/system-python/add-executable-option.patch
History
Date User Action Args
2017-02-01 10:43:53Michal Cypriansetrecipients: + Michal Cyprian, eric.araujo, dstufft
2017-02-01 10:43:53Michal Cypriansetmessageid: <1485945833.17.0.354426636585.issue29411@psf.upfronthosting.co.za>
2017-02-01 10:43:53Michal Cyprianlinkissue29411 messages
2017-02-01 10:43:52Michal Cypriancreate