Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-16 Thread Nathaniel Smith
On Sat, Oct 15, 2016 at 4:38 PM, Ben Finney wrote: > Thomas Kluyver writes: > >> If the entry point looks like: >> >> foo=foomod:main >> >> Then you can invoke it in a subprocess by running: >> >> subprocess.Popen([sys.executable, '-c', 'import foomod; foomod.main()']) > > That will invoke the pr

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-16 Thread Paul Moore
On 16 October 2016 at 00:38, Ben Finney wrote: >> This avoids the need to work out where the 'foo' script has been >> installed to. > > So, I'm still wanting to know from Setuptools itself at run time, what > filesystem path Setuptools installed the command to. Setuptools doesn't install the comm

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Daniel Holth
It does not store that information, except maybe in the manifest used for uninstall in the .*-info directory for your installed distribution. On Sat, Oct 15, 2016, 19:39 Ben Finney wrote: > Thomas Kluyver writes: > > > If the entry point looks like: > > > > foo=foomod:main > > > > Then you can

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Ben Finney
Thomas Kluyver writes: > If the entry point looks like: > > foo=foomod:main > > Then you can invoke it in a subprocess by running: > > subprocess.Popen([sys.executable, '-c', 'import foomod; foomod.main()']) That will invoke the program. I'll probably try that. One disadvantage there is the pro

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Thomas Kluyver
On Sat, Oct 15, 2016, at 06:57 PM, Ben Finney wrote: > 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. If the entry point looks like: foo=foomod:main Then you can invoke it in a subprocess by running:

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Ben Finney
Nick Timkovich writes: > 1. include the shell scripts (could also be binaries) in the package & > manifest > (https://github.com/nicktimko/autolycus/blob/master/MANIFEST.in#L3) No, I'm using ‘[…] install --install-scripts=APPLICATION_SCRIPTS_PATH’ at install time. > 2. use pkg_resources to get

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Nick Timkovich
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 wrote: > I recently was trying to port a mix of shell & Python scripts to pure > Python (https:/

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Nick Timkovich
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/auto

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Ben Finney
Nick Timkovich 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

Re: [Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Nick Timkovich
Usually that entry point is on the PATH, so it should be somewhere in os.environ['PATH'], so if you just `subprocess.run(['myentrything'])` that would fire it. 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 m

[Distutils] Interrogate distribution for an entry point command path

2016-10-15 Thread Ben Finney
Howdy, How can a Python application discover at run-time where on the filesystem its own ‘entry_points’ programs are available? The Setuptools ‘entry_points’ are available at run-time to the distribution, via the ‘pkg_resources’ API for entry points https://setuptools.readthedocs.io/en/latest/pkg