On Tue, 21 Jul 2009 21:23:00 -0700, P.J. Eby <[email protected]> wrote:


If I were trying to do what you're doing, I'd just run a bdist_egg on the package and inspect it via the API. Or, alternately, I'd run the egg_info command with an explicit target directory, then load it via the regular API. (By "regular API" I mean such things as a find_distributions() call aimed at the parent of the .egg-info directory.)

And I'd do it that way because then I wouldn't need to care whether the distribution was created with setuptools or not.

How can you run egg_info ('python setup.py egg_info') on a distribution that does not use setuptools?


Actually, I'd probably just use "easy_install -zmaxNd sometmpdir Projectname", followed by looping over find_distributions('sometmpdir') and returning the _dep_map of the first yielded Distribution. (The "zmaxNd" means "install as a zipfile, don't munge .pth files or sys.path, ensure that you copy the needed file to the target directory, exclude scripts, no dependencies, and here's the directory to put it in".)

But bdist_egg and -zmaxNd will also *build* the distribution .. which I don't want to do just for extracting the metadata.

This recipe will handle source, eggs, or win32 .exe files without complaint, and work on distutils or setuptools-based projects, as long as they don't break sandboxing or do something silly in their setup.py.

Actually .. I am only downloading source dists.

-srid

PS: what I am actually doing is this: download the source tarballs for *all* packages registered in PyPI; and extract (cache) their metadata (PKG-INFO and requires.txt) outside the tarball.




_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to