Commit 0993e964 authored by PJ Eby's avatar PJ Eby

Minor refactoring of code that checks a distribution's contents.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041203
parent af4cec25
...@@ -53,9 +53,7 @@ def check_nsp(dist, attr, value): ...@@ -53,9 +53,7 @@ def check_nsp(dist, attr, value):
assert_string_list(dist,attr,value) assert_string_list(dist,attr,value)
for nsp in value: for nsp in value:
for name in dist.iter_distribution_names(): if not dist.has_contents_for(nsp):
if name.startswith(nsp+'.'): break
else:
raise DistutilsSetupError( raise DistutilsSetupError(
"Distribution contains no modules or packages for " + "Distribution contains no modules or packages for " +
"namespace package %r" % nsp "namespace package %r" % nsp
...@@ -80,6 +78,8 @@ def assert_bool(dist, attr, value): ...@@ -80,6 +78,8 @@ def assert_bool(dist, attr, value):
"%r must be a boolean value (got %r)" % (attr,value) "%r must be a boolean value (got %r)" % (attr,value)
) )
def check_install_requires(dist, attr, value): def check_install_requires(dist, attr, value):
"""Verify that install_requires is a valid requirements list""" """Verify that install_requires is a valid requirements list"""
try: try:
...@@ -436,17 +436,17 @@ class Distribution(_Distribution): ...@@ -436,17 +436,17 @@ class Distribution(_Distribution):
pfx = package+'.' pfx = package+'.'
for p in self.packages or (): for p in self.iter_distribution_names():
if p==package or p.startswith(pfx): if p==package or p.startswith(pfx):
return True return True
for p in self.py_modules or ():
if p==package or p.startswith(pfx):
return True
for p in self.ext_modules or ():
if p.name==package or p.name.startswith(pfx):
return True
def _exclude_misc(self,name,value): def _exclude_misc(self,name,value):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment