[Python-checkins] commit of r41483 - in sandbox/trunk/setuptools: . setuptools setuptools.egg-info setuptools/command
phillip.eby@python.org
phillip.eby at python.org
Sat Nov 19 21:38:41 CET 2005
Author: phillip.eby
Date: Sat Nov 19 21:38:40 2005
New Revision: 41483
Modified:
sandbox/trunk/setuptools/setup.py
sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt
sandbox/trunk/setuptools/setuptools.txt
sandbox/trunk/setuptools/setuptools/command/test.py
sandbox/trunk/setuptools/setuptools/dist.py
Log:
Added ``tests_require`` keyword to ``setup()``, so that e.g. packages
requiring ``nose`` to run unit tests can make this dependency optional
unless the ``test`` command is run.
Modified: sandbox/trunk/setuptools/setup.py
==============================================================================
--- sandbox/trunk/setuptools/setup.py (original)
+++ sandbox/trunk/setuptools/setup.py Sat Nov 19 21:38:40 2005
@@ -40,6 +40,7 @@
py_modules = ['pkg_resources', 'easy_install', 'site'],
zip_safe = False, # We want 'python -m easy_install' to work, for now :(
+
entry_points = {
"distutils.commands" : [
"%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals()
@@ -49,7 +50,8 @@
"eager_resources = setuptools.dist:assert_string_list",
"namespace_packages = setuptools.dist:check_nsp",
"extras_require = setuptools.dist:check_extras",
- "install_requires = setuptools.dist:check_install_requires",
+ "install_requires = setuptools.dist:check_requirements",
+ "tests_require = setuptools.dist:check_requirements",
"entry_points = setuptools.dist:check_entry_points",
"test_suite = setuptools.dist:check_test_suite",
"zip_safe = setuptools.dist:assert_bool",
@@ -67,6 +69,17 @@
"console_scripts":
["easy_install = setuptools.command.easy_install:main"],
},
+
+
+
+
+
+
+
+
+
+
+
classifiers = [f.strip() for f in """
Development Status :: 3 - Alpha
Intended Audience :: Developers
@@ -108,16 +121,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt (original)
+++ sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt Sat Nov 19 21:38:40 2005
@@ -1,12 +1,13 @@
[distutils.setup_keywords]
entry_points = setuptools.dist:check_entry_points
extras_require = setuptools.dist:check_extras
-install_requires = setuptools.dist:check_install_requires
+install_requires = setuptools.dist:check_requirements
include_package_data = setuptools.dist:assert_bool
namespace_packages = setuptools.dist:check_nsp
test_suite = setuptools.dist:check_test_suite
eager_resources = setuptools.dist:assert_string_list
zip_safe = setuptools.dist:assert_bool
+tests_require = setuptools.dist:check_requirements
[egg_info.writers]
requires.txt = setuptools.command.egg_info:write_requirements
Modified: sandbox/trunk/setuptools/setuptools.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.txt (original)
+++ sandbox/trunk/setuptools/setuptools.txt Sat Nov 19 21:38:40 2005
@@ -355,6 +355,17 @@
specified test suite, e.g. via ``setup.py test``. See the section on the
`test`_ command below for more details.
+``tests_require``
+ If your project's tests need one or more additional packages besides those
+ needed to install it, you can use this option to specify them. It should
+ be a string or list of strings specifying what other distributions need to
+ be present for the package's tests to run. When you run the ``test``
+ command, ``setuptools`` will attempt to obtain these (even going
+ so far as to download them using ``EasyInstall``). Note that these
+ required projects will *not* be installed on the system where the tests
+ are run, but only downloaded to the project's setup directory if they're
+ not already installed locally.
+
``eager_resources``
A list of strings naming resources that should be extracted together, if
any of them is needed, or if any C extensions included in the project are
@@ -1996,7 +2007,7 @@
----------------------------
Sometimes, your commands may need additional arguments to the ``setup()``
-script. You can enable this by defining entry points in the
+call. You can enable this by defining entry points in the
``distutils.setup_keywords`` group. For example, if you wanted a ``setup()``
argument called ``bar_baz``, you might add something like this to your
distutils extension project's setup script::
@@ -2041,8 +2052,9 @@
Also note that as with commands, it is not necessary to subclass or monkeypatch
the distutils ``Distribution`` class in order to add your arguments; it is
-sufficient to define the entry points in your extension, as long as the setup
-script lists your extension in its ``setup_requires`` argument.
+sufficient to define the entry points in your extension, as long as any setup
+script using your extension lists your project in its ``setup_requires``
+argument.
Adding new EGG-INFO Files
@@ -2157,6 +2169,10 @@
* Added warning for namespace packages with missing ``declare_namespace()``
+ * Added ``tests_require`` keyword to ``setup()``, so that e.g. packages
+ requiring ``nose`` to run unit tests can make this dependency optional
+ unless the ``test`` command is run.
+
0.6a8
* Fixed some problems building extensions when Pyrex was installed, especially
with Python 2.4 and/or packages using SWIG.
Modified: sandbox/trunk/setuptools/setuptools/command/test.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/test.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/test.py Sat Nov 19 21:38:40 2005
@@ -47,6 +47,9 @@
self.reinitialize_command('build_ext', inplace=1)
self.run_command('build_ext')
+ if self.distribution.tests_require:
+ self.distribution.fetch_build_eggs(self.distribution.tests_require)
+
if self.test_suite:
cmd = ' '.join(self.test_args)
if self.dry_run:
@@ -55,6 +58,7 @@
self.announce('running "unittest %s"' % cmd)
self.run_tests()
+
def run_tests(self):
import unittest
old_path = sys.path[:]
@@ -76,7 +80,3 @@
-
-
-
-
Modified: sandbox/trunk/setuptools/setuptools/dist.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/dist.py (original)
+++ sandbox/trunk/setuptools/setuptools/dist.py Sat Nov 19 21:38:40 2005
@@ -80,14 +80,14 @@
-def check_install_requires(dist, attr, value):
+def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list"""
try:
list(pkg_resources.parse_requirements(value))
except (TypeError,ValueError):
raise DistutilsSetupError(
- "'install_requires' must be a string or list of strings "
- "containing valid project/version requirement specifiers"
+ "%r must be a string or list of strings "
+ "containing valid project/version requirement specifiers" % (attr,)
)
def check_entry_points(dist, attr, value):
More information about the Python-checkins
mailing list