aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2008-02-14 21:23:15 +0000
committerPJ Eby <distutils-sig@python.org>2008-02-14 21:23:15 +0000
commit798b6f9b3aeba38aa4701a3d3ccf2599b053dc95 (patch)
tree7378b491d2b0e993f044c52f09a5a6ba8d63fe13
parenta0955a7e17e903248462b282acca8fd3d4a6a4a3 (diff)
downloadexternal_python_setuptools-798b6f9b3aeba38aa4701a3d3ccf2599b053dc95.tar.gz
external_python_setuptools-798b6f9b3aeba38aa4701a3d3ccf2599b053dc95.tar.bz2
external_python_setuptools-798b6f9b3aeba38aa4701a3d3ccf2599b053dc95.zip
Added a warning if a namespace package is declared, but its parent
package is not also declared as a namespace. (backport from trunk) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4060817
-rwxr-xr-xsetuptools.txt3
-rw-r--r--setuptools/dist.py22
2 files changed, 14 insertions, 11 deletions
diff --git a/setuptools.txt b/setuptools.txt
index 88f841d3..41687e1a 100755
--- a/setuptools.txt
+++ b/setuptools.txt
@@ -2628,6 +2628,9 @@ Release Notes/Change History
* Allow ``ez_setup.use_setuptools()`` to upgrade existing setuptools
installations when called from a standalone ``setup.py``.
+ * Added a warning if a namespace package is declared, but its parent package
+ is not also declared as a namespace.
+
0.6c7
* Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and
``egg_info`` command failing on new, uncommitted SVN directories.
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 700c57dc..30ff35e3 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