[Distutils] Question on using distutils.core.run_setup

Terry Jones terry at jon.es
Tue Mar 18 06:27:50 CET 2008

[Apologies if this is in the mailing list archives. I looked but didn't
see anything, based on a search for run_setup]

I'm trying to programmatically install something built using distutils. I
found distutils.core.run_setup and can use it via

  >>> dist = run_setup('setup.py', ['-q', 'install'])

Is that the recommended way to do an install from inside Python (as opposed
to doing it on the command line)?

If so, how can I find where the thing(s) I installed now resides?  I saw
dist.packages but that just has top-level package names. I could __import__
these (and then use module.__file__), but that's not a good solution as it
may run code I don't want run. On my machine, I can see the packages have
been installed under the system's python2.5/site-packages directory. But
how can I determine that programmatically? I don't see anything useful on
the distutils.dist.Distribution instance I'm getting back from run_setup.



More information about the Distutils-SIG mailing list