At 05:07 PM 6/4/2007 -0700, Rob wrote:
Phillip J. Eby wrote:
If you use "-e sometmpdir" as an option, you can have the .egg-info put in a temporary directory with a known location. You need this because some package layouts don't have the .egg-info in the package root, so the rest of your stuff won't work.
To be honest, though, I think you're going to way too much trouble here. Just what exactly is the use case here? Couldn't you just easy_install the package to a temporary directory with --no-deps? Why do you think you need to inspect the setup.py in the first place?
Sorry, I should have explained what I was attempting.
The code is going to be used for g-pypi[1], a tool I wrote specifically for creating ebuilds for Gentoo's portage package manager. It creates ebuilds by using setuptools and querying The Cheese Shop.
In that case, using "easy_install -mNd atempdir sourcedir" is probably your best recipe. After easy_install runs, "atempdir" will contain an egg built from "sourcedir", and you can then query it via the standard API. You don't even need to run it with system(); here's your recipe: from setuptools.command.easy_install import main as easy from pkg_resources import find_distributions easy(['-Nmxd', atempdir, sourcedir]) for dist in find_distributions(atempdir): requirements = dist.requires() # ...and whatever atempdir should be an empty directory prior to the easy-install invocation, of course. The -N means no dependencies, -m means multi-version (no .pth file), -x excludes scripts, and -d sets the target directory.
participants (1)
-
Phillip J. Eby