-----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 [EMAIL PROTECTED]
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-----
Index: setuptools/dist.py
===================================================================
--- setuptools/dist.py (revision 43078)
+++ setuptools/dist.py (working copy)
@@ -211,6 +211,10 @@
self.features = {}
self.dist_files = []
self.patch_missing_pkg_info(attrs)
+ if attrs and 'dependency_links' in attrs:
+ # Make sure we have any eggs needed to interpret 'attrs'
+ self.dependency_links = attrs.pop('dependency_links')
+
if attrs and 'setup_requires' in attrs:
# Make sure we have any eggs needed to interpret 'attrs'
self.fetch_build_eggs(attrs.pop('setup_requires'))
@@ -273,6 +277,8 @@
for key in opts.keys():
if key not in keep:
del opts[key] # don't use any other settings
+ if self.dependency_links:
+ opts['find_links'] = ('setup', self.dependency_links)
cmd = easy_install(
dist, args=["x"], install_dir=os.curdir, exclude_scripts=True,
always_copy=False, build_directory=None, editable=False,
Index: setup.py
===================================================================
--- setup.py (revision 43078)
+++ setup.py (working copy)
@@ -56,6 +56,7 @@
"extras_require = setuptools.dist:check_extras",
"install_requires = setuptools.dist:check_requirements",
"tests_require = setuptools.dist:check_requirements",
+ "dependency_links = setuptools.dist:assert_string_list",
"entry_points = setuptools.dist:check_entry_points",
"test_suite = setuptools.dist:check_test_suite",
"zip_safe = setuptools.dist:assert_bool",
@@ -68,6 +69,7 @@
"requires.txt = setuptools.command.egg_info:write_requirements",
"entry_points.txt = setuptools.command.egg_info:write_entries",
"eager_resources.txt = setuptools.command.egg_info:write_arg",
+ "dependency_links.txt = setuptools.command.egg_info:write_arg",
"namespace_packages.txt = setuptools.command.egg_info:write_arg",
"top_level.txt = setuptools.command.egg_info:write_toplevel_names",
"depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
Index: setuptools.txt
===================================================================
--- setuptools.txt (revision 43078)
+++ setuptools.txt (working copy)
@@ -366,6 +366,8 @@
mess with it. For more details on how this argument works, see the section
below on `Automatic Resource Extraction`_.
+``dependency_links``
+ A list of strings naming URLs to be searched when satisfying dependencies.
Using ``find_packages()``
-------------------------
Index: setuptools.egg-info/entry_points.txt
===================================================================
--- setuptools.egg-info/entry_points.txt (revision 43078)
+++ setuptools.egg-info/entry_points.txt (working copy)
@@ -1,4 +1,5 @@
[distutils.setup_keywords]
+dependency_links = setuptools.dist:assert_string_list
entry_points = setuptools.dist:check_entry_points
extras_require = setuptools.dist:check_extras
package_data = setuptools.dist:check_package_data
@@ -15,8 +16,9 @@
requires.txt = setuptools.command.egg_info:write_requirements
PKG-INFO = setuptools.command.egg_info:write_pkg_info
eager_resources.txt = setuptools.command.egg_info:write_arg
+namespace_packages.txt = setuptools.command.egg_info:write_arg
top_level.txt = setuptools.command.egg_info:write_toplevel_names
-namespace_packages.txt = setuptools.command.egg_info:write_arg
+dependency_links.txt = setuptools.command.egg_info:write_arg
entry_points.txt = setuptools.command.egg_info:write_entries
depends.txt = setuptools.command.egg_info:warn_depends_obsolete
_______________________________________________
Distutils-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig