[Distutils] Parsing setup()
Robert Kern
robert.kern at gmail.com
Tue Jun 5 01:19:06 CEST 2007
Rob wrote:
> Ian Bicking wrote:
>
>> If you have a built egg (which you can do with python setup.py egg_info, without actually installing
>> anything) you can read the requires.txt file with pkg_resources.
>
> I had tried that but I was having problems with un-installed packages.
>
> I have this so far, which works with *nux, but I'll have to figure out
> how to find the correct Python
> executable in Windows (I think using different Python versions could
> yield different requirements?).
>
>
> pkg_name = "pycopia-net"
> os.chdir(setup_dir)
> os.system("/usr/bin/env python %s egg_info" % setup_file)
You probably want to use sys.executable (and the subprocess module if you have
Python >= 2.4):
import subprocess
import sys
subprocess.call([sys.executable, 'setup.py', 'egg_info'])
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Distutils-SIG
mailing list