New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option --executable for entry_points #73597
Comments
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. 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 |
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.) |
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. [3] mcyprian/python3@9f84346#diff-31675636be8fb69017233f887ec14006R1 [4] https://groups.google.com/forum/#!topic/pypa-dev/qP8vcZlEfw8 |
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. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: