diff options
author | phillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771> | 2008-02-14 21:17:14 +0000 |
---|---|---|
committer | phillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771> | 2008-02-14 21:17:14 +0000 |
commit | 2c2eae741d216a902147e5e60a8b8f07f1fe8055 (patch) | |
tree | 9e3696b21bab7655758386d9a279427b941b65a9 | |
parent | 7aedcb952c45cf5e9b67fb8d31df8b448b1b7486 (diff) | |
download | python-setuptools-2c2eae741d216a902147e5e60a8b8f07f1fe8055.tar.gz |
Warn if a namespace package is declared, but its parent
package is not.
git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@60815 6015fed2-1504-0410-9fe1-9d1591cc4771
-rw-r--r-- | setuptools/dist.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index 356d038..aa8880f 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -8,7 +8,7 @@ from setuptools.command.install_lib import install_lib from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError import setuptools, pkg_resources, distutils.core, distutils.dist, distutils.cmd -import os +import os, distutils.log def _get_unpatched(cls): """Protect against re-patching the distutils if reloaded @@ -51,13 +51,19 @@ def assert_string_list(dist, attr, value): def check_nsp(dist, attr, value): """Verify that namespace packages are valid""" assert_string_list(dist,attr,value) - for nsp in value: if not dist.has_contents_for(nsp): raise DistutilsSetupError( "Distribution contains no modules or packages for " + "namespace package %r" % nsp ) + if '.' in nsp: + parent = '.'.join(nsp.split('.')[:-1]) + if parent not in value: + distutils.log.warn( + "%r is declared as a package namespace, but %r is not:" + " please correct this in setup.py", nsp, parent + ) def check_extras(dist, attr, value): """Verify that extras_require mapping is valid""" @@ -71,15 +77,15 @@ def check_extras(dist, attr, value): "requirement specifiers." ) + + + def assert_bool(dist, attr, value): """Verify that value is True, False, 0, or 1""" if bool(value) != value: raise DistutilsSetupError( "%r must be a boolean value (got %r)" % (attr,value) ) - - - def check_requirements(dist, attr, value): """Verify that install_requires is a valid requirements list""" try: @@ -89,7 +95,6 @@ def check_requirements(dist, attr, value): "%r must be a string or list of strings " "containing valid project/version requirement specifiers" % (attr,) ) - def check_entry_points(dist, attr, value): """Verify that entry_points map is parseable""" try: @@ -97,12 +102,10 @@ def check_entry_points(dist, attr, value): except ValueError, e: raise DistutilsSetupError(e) - def check_test_suite(dist, attr, value): if not isinstance(value,basestring): raise DistutilsSetupError("test_suite must be a string") - def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" if isinstance(value,dict): @@ -118,9 +121,6 @@ def check_package_data(dist, attr, value): "wildcard patterns" ) - - - class Distribution(_Distribution): """Distribution with support for features, tests, and package data |