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.

Title: Option --executable for entry_points
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Michal Cyprian, cstratak, dstufft, eric.araujo
Priority: normal Keywords:

Created on 2017-02-01 10:43 by Michal Cyprian, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg286612 - (view) Author: Michal Cyprian (Michal Cyprian) Date: 2017-02-01 10:43
1. python3 build --executable="/usr/bin/binary"
2. python3 install -O1 --skip-build

These two commands are typically used to build and install Python packages from sources. Let's assume there is a 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 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.

msg286921 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-02-04 07:14
Thanks for the report, Michal. Note that both [1] and [2] point to the same patch. Perhaps you meant to paste a link to a separate patch for distutils?

(I removed 3.3 and 3.4 from the versions field since they are in security-fix-only mode now. I don't know whether this can be applied as a bugfix or not without reading the pypa-dev thread and the patch for distutils so I left rest of it selected.)
msg286931 - (view) Author: Michal Cyprian (Michal Cyprian) Date: 2017-02-04 08:45
Yes, both references in my previous message point to the patch for setuptools, sorry for that. Here [3] is the patch that I prepared for distutils. I marked all the versions, because this functionality is missing in all of them. In my opinion it will be enough to apply this patch to the latest Python3 and Python2 version.

pypa-dev thread is here [4]. The response that I've got is not publicly visible. I am not sure why it was sent directly to my address. I will ask them to make it public. In short this PR will be helpful for setuptools and they asked me to check also how can distlib and pip support this use case.


msg379360 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-10-22 21:37
Closing this; the distutils patch was never attached here, and now setuptools has its own copy of distutils so if this feature request is pursued all the changes will happen there.
Date User Action Args
2022-04-11 14:58:42adminsetgithub: 73597
2020-10-22 21:37:41eric.araujosetstatus: open -> closed
resolution: third party
messages: + msg379360

stage: resolved
2018-07-27 13:12:25berker.peksagsetnosy: - berker.peksag
2017-06-28 13:53:33cstrataksetnosy: + cstratak
2017-02-04 08:45:51Michal Cypriansetmessages: + msg286931
2017-02-04 07:14:22berker.peksagsetnosy: + berker.peksag

messages: + msg286921
versions: - Python 3.3, Python 3.4
2017-02-01 10:43:53Michal Cypriancreate