[Distutils] Interrogate distribution for an entry point command path

Nick Timkovich prometheus235 at gmail.com
Sat Oct 15 14:12:14 EDT 2016


The entry points aren't needed at all in that case, but I made a shim (that
legacy.py) anyways to have access to the packaged shell script for testing.

On Sat, Oct 15, 2016 at 1:05 PM, Nick Timkovich <prometheus235 at gmail.com>
wrote:

> I recently was trying to port a mix of shell & Python scripts to pure
> Python (https://github.com/nicktimko/autolycus), and my interim solution
> to get something working to test was to:
>
> 1. include the shell scripts (could also be binaries) in the package &
> manifest (https://github.com/nicktimko/autolycus/blob/master/
> MANIFEST.in#L3)
> 2. use pkg_resources to get where the .sh was so I could run it with
> subprocess. (https://github.com/nicktimko/autolycus/blob/master/
> autolycus/legacy.py)
>
> Closer to what you need?
>
> On Sat, Oct 15, 2016 at 12:57 PM, Ben Finney <ben+python at benfinney.id.au>
> wrote:
>
>> Nick Timkovich <prometheus235 at gmail.com> writes:
>>
>> > Usually that entry point is on the PATH […]
>>
>> It's not, because I'm deliberately specifying that it shouldn't be, at
>> install time. This is an executable that is private to the application
>> and not for general availability on the host.
>>
>> > If you want to call that entry point from your code, the clean way
>> > (same environment/version, and especially if you don't need to bother
>> > multiprocessing it) would be to import the corresponding entry point
>> > function & call that.
>>
>> I'm modifying an existing application that invokes the program as a
>> subprocess, so I'm wanting to find that program as an external command.
>>
>> > I might not be answering your question directly, but hopefully there's
>> > a workaround there. What's your use-case for grabbing the exec path?
>>
>> Existing code assumes it is an external command on the shell PATH, but
>> I'm changing that so that it's not on PATH. I need to make a minimal
>> change and want to ensure that I get the right filesystem path based on
>> what the distribution knows about itself.
>>
>> --
>>  \      “I like to fill my bathtub up with water, then turn the shower |
>>   `\       on and pretend I'm in a submarine that's been hit.” —Steven |
>> _o__)                                                           Wright |
>> Ben Finney
>>
>> _______________________________________________
>> Distutils-SIG maillist  -  Distutils-SIG at python.org
>> https://mail.python.org/mailman/listinfo/distutils-sig
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20161015/dbfa5f67/attachment.html>


More information about the Distutils-SIG mailing list