[New-bugs-announce] [issue29411] Option --executable for entry_points
Michal Cyprian
report at bugs.python.org
Wed Feb 1 05:43:53 EST 2017
New submission from Michal Cyprian:
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
----------
components: Distutils
messages: 286612
nosy: Michal Cyprian, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Option --executable for entry_points
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29411>
_______________________________________
More information about the New-bugs-announce
mailing list