
At 05:27 PM 3/5/2009 +0000, Fadhley Salim wrote:
In an automated build environment I need to be able to make eggs which depend on non-released "testing" eggs. These are all published to a web-server operated by my team.
I know that it's possible to globally change the default URLs of the "--find-links" easy_install option by editing the distutils.cfg file, however I want a fully automated process which will validate a system's configuration and determine if the test-egg URL have been added to the system. If not, I want my build process to fail with an explicit error emssage.
Other than by directly inspecting and parsing this file, is there a programatic way to find which hosts have been configured in the distutils.cfg file? Ideally I'd like to access this information via pkg_resources.
It's not available there. You would need to create an easy_install command instance and inspect its find_links attribute. Something like:
ei = makeSetup().get_command_obj('easy_install') ei.ensure_finalized() print ei.find_links
See the 'makeSetup()' function in setuptools/tests/__init__.py for how to do the equivalent.
(Now, if what you're really asking is, can you tell whether a specific version of an egg is available on sys.path, you can certainly do that by checking pkg_resources.require('projectname')[0].version to see if it's the version you want.)