Fwd: Option --executable for entry_points

30 views
Skip to first unread message

Jason R. Coombs

unread,
Feb 9, 2017, 10:53:55 AM2/9/17
to pypa-dev
I meant to send my reply to pypa-dev, not privately.

Begin forwarded message:

From: "Jason R. Coombs" <jar...@jaraco.com>
Subject: Re: Option --executable for entry_points
Date: 23 January, 2017 at 21:37:35 EST

Hi Michal. Yes, a ticket and PR to Setuptools will be helpful. Also, please search through the existing tickets to see if there's been work in this area and what issues might have arisen.

One issue is that Setuptools isn't the only installer. There is also pip, which uses distlib to install scripts for console script entry points. Setuptools hopes to adopt that library in place of its own behavior, so you may want to focus your efforts on how distilling and pip can support your use case.

Sent from my comm

On Jan 18, 2017, at 07:17, "mcyp...@redhat.com" <mcyp...@redhat.com> wrote:

Hello,

these two command are typically used to build and install python package from sources:

1. python3 setup.py build --executable="/usr/bin/binary"
2. python3 setup.py install -O1 --skip-build
 
Let's assume there is a setup.py script of package foo, containing a script foo. The --executable
option
of the build command (1) should set the shebang of the script foo to #!/usr/bin/binary.
Problem is that this option doesn't work for scripts listed in setup.py as entry_points, w
hich is the
most common way of ha
ndling 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 package contains
only
entry_points.

The scripts listed as entry_points are processed during execution of the install command (2)
(
in the easy_install command, specifically), 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 the 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 as a PR in setuptools if the second patch gets merged into distutils?


Michal Cyprian

Reply all
Reply to author
Forward
0 new messages