setup.py test doesn't honor --find-links

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Can we extend the test command (deriving from easy_install, I guess, instead of Command), to take the same options it does? I tried hacking at it a bit, but without much success so far: I've gotten it to accept the '--find-links' option, but not actually to *use* it: $ cd ~/projects/eggz/src/zope.tales $ ../../bin/python setup.py test \ --find-links="http://download.zope.org/distribution" running test running egg_info writing requirements to src/zope.tales.egg-info/requires.txt writing src/zope.tales.egg-info/PKG-INFO writing top-level names to src/zope.tales.egg-info/top_level.txt writing namespace_packages to src/zope.tales.egg-info/namespace_packages.txt warning: manifest_maker: standard file not found: should have one of README, README.txt writing manifest file 'src/zope.tales.egg-info/SOURCES.txt' running build_ext Checking .pth file support in . /home/tseaver/projects/PyCon2006/eggification/sandbox/src/zope.tales/../../bin/python - -E -c pass Searching for zope.testing Reading http://www.python.org/pypi/zope.testing/ Couldn't find index page for 'zope.testing' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://www.python.org/pypi/ No local packages or download links found for zope.testing error: Could not find suitable distribution for Requirement.parse('zope.testing') I'm attaching the patch against the current SVN head, Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEFt/z+gerLs4ltQ4RAvdFAKCRSHP44tnDHIKdnHP7dEtZxvyqBgCdFWBE dULlC535P+qeO8m5MZLogig= =lM5x -----END PGP SIGNATURE-----

At 10:23 AM 3/14/2006 -0500, Tres Seaver wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Can we extend the test command (deriving from easy_install, I guess, instead of Command), to take the same options it does?
I don't think that approach is a good idea, as it's more complex and isn't orthogonal to other setuptools features that install eggs for build purposes (e.g. setup_requires). It would probably be better to implement the "dependency_links" feature described here: http://mail.python.org/pipermail/distutils-sig/2005-October/005209.html and make it be used by the setuptools.dist.Distribution class's "fetch_build_egg()" method, which is used for both setup_requires and tests_require. I've left that feature open for a while in the hopes that it would provide some enterprising soul with an easy project to learn about extending setuptools, as it's mostly pretty shallow to implement. The only part such an enterprising party might need help with is the bit that touches easy_install; the rest should be a matter of just copying existing entry points defined in setuptools' setup.py.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phillip J. Eby wrote:
At 10:23 AM 3/14/2006 -0500, Tres Seaver wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Can we extend the test command (deriving from easy_install, I guess, instead of Command), to take the same options it does?
I don't think that approach is a good idea, as it's more complex and isn't orthogonal to other setuptools features that install eggs for build purposes (e.g. setup_requires). It would probably be better to implement the "dependency_links" feature described here:
http://mail.python.org/pipermail/distutils-sig/2005-October/005209.html
and make it be used by the setuptools.dist.Distribution class's "fetch_build_egg()" method, which is used for both setup_requires and tests_require.
I've left that feature open for a while in the hopes that it would provide some enterprising soul with an easy project to learn about extending setuptools, as it's mostly pretty shallow to implement. The only part such an enterprising party might need help with is the bit that touches easy_install; the rest should be a matter of just copying existing entry points defined in setuptools' setup.py.
I'm a bit lost as to the rationale for the separate metadata filee in that post: why wouldn't we just use the 'dependency_links' attribute of the distribution? At any rate, I'm attaching a partially-working patch. I could get the 'dependency_links.txt' file to be created, but couldn't figure out how to use the pkg_resources facilities for reading it while inside 'fetch_build_eggs'. I alos ran into the problem that, since the 'test' command doesn't support the usual 'easy_install' arguments (my original reason for posting), I couldn't control where the downloaded packages would be installed: they went directly in my local sandbox. In case it wasn't clear from my original post, I have the following use case: - Check out the "packaging bits" for a Zope egg I want to build, e.g.: $ svn co svn+ssh://svn.zope.org/repos/main/zope.interface/trunk zi $ cd zi - Run the tests, first downloading and installing any dependencies (including'test_requires'). Preferably, those dependencies should *not* be installed into 'site-packages'; I want to verify that the package correctly identifies all of its own dependencies, without relying on any other environment except a "bare" virtual python: $ /path/to/python setup.py test ... No local packages or download links found for zope.testing error: Could not find suitable distribution for \ Requirement.parse('zope.testing') My original plan was to add the 'easy_install' command line args to the 'test' command, which would have allowed: $ /path/to/python setup.py test \ --find-links="http://download.zope.org/distribution" Under the mechanism you redireted me to, I need to add the equivalent URL into zi/setup.py as a 'dependency_link' argument to 'setup', and then arrange for that value to be used as the 'find_links' value for the 'test' command. Is that what you intended? Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEGYnE+gerLs4ltQ4RAvoNAJ0bXH1PaiSiwCrkUNX9vKcUKmZd6wCdHusa nbxSITAWe1kk4L9e300djFA= =YA3h -----END PGP SIGNATURE-----

At 10:52 AM 3/16/2006 -0500, Tres Seaver wrote:
I'm a bit lost as to the rationale for the separate metadata filee in that post: why wouldn't we just use the 'dependency_links' attribute of the distribution?
Because the original post is discussing the scenario where you are installing an egg that was already built by someone else. You're correct that the fetch_build_eggs() method can and should just use the attribute directly.
At any rate, I'm attaching a partially-working patch.
I'll take it for a spin. It looks pretty good, except that easy_install doesn't use it. I can go ahead and add that bit. The doc is a bit, um, terse, but I can flesh it out a bit I guess. :)
I could get the 'dependency_links.txt' file to be created, but couldn't figure out how to use the pkg_resources facilities for reading it while inside 'fetch_build_eggs'.
You don't need to; it's the easy_install command that needs to do that, in process_distribution() I believe.
I alos ran into the problem that, since the 'test' command doesn't support the usual 'easy_install' arguments (my original reason for posting), I couldn't control where the downloaded packages would be installed: they went directly in my local sandbox.
That's where build dependencies are supposed to go, actually; building and testing a package shouldn't cause build-time dependencies to be permanently installed on the build system, without an explicit action. You can always "easy_install *.egg" if you want to make them permanent.
My original plan was to add the 'easy_install' command line args to the 'test' command, which would have allowed:
$ /path/to/python setup.py test \ --find-links="http://download.zope.org/distribution"
Under the mechanism you redireted me to, I need to add the equivalent URL into zi/setup.py as a 'dependency_link' argument to 'setup', and then arrange for that value to be used as the 'find_links' value for the 'test' command. Is that what you intended?
Yes; it should get passed to the find_links argument given to the easy_install command instance created by Distribution.fetch_build_eggs(), which is what your patch does.
participants (2)
-
Phillip J. Eby
-
Tres Seaver