[Python-checkins] python/nondist/sandbox/setuptools/setuptools dist.py, 1.14, 1.15
pje@users.sourceforge.net
pje at users.sourceforge.net
Sun Jul 24 19:59:29 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8768/setuptools
Modified Files:
dist.py
Log Message:
Fix eager resource extraction. Add eager_resources setup() argument. Add
support for obtaining project-level resources by making get_provider()
accept Requirement objects.
Index: dist.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/dist.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dist.py 10 Jul 2005 15:43:08 -0000 1.14
+++ dist.py 24 Jul 2005 17:59:26 -0000 1.15
@@ -92,6 +92,7 @@
self.dist_files = []
self.zip_safe = None
self.namespace_packages = None
+ self.eager_resources = None
_Distribution.__init__(self,attrs)
if not have_package_data:
from setuptools.command.build_py import build_py
@@ -120,16 +121,18 @@
-
def finalize_options(self):
_Distribution.finalize_options(self)
+
if self.features:
self._set_global_opts_from_features()
+
if self.extra_path:
raise DistutilsSetupError(
"The 'extra_path' parameter is not needed when using "
"setuptools. Please remove it from your setup script."
)
+
try:
list(pkg_resources.parse_requirements(self.install_requires))
except (TypeError,ValueError):
@@ -137,6 +140,7 @@
"'install_requires' must be a string or list of strings "
"containing valid project/version requirement specifiers"
)
+
try:
for k,v in self.extras_require.items():
list(pkg_resources.parse_requirements(v))
@@ -146,22 +150,27 @@
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)
- if self.namespace_packages is not None:
- try:
- assert ''.join(self.namespace_packages)!=self.namespace_packages
- except (TypeError,ValueError,AttributeError,AssertionError):
- raise DistutilsSetupError(
- "'namespace_packages' must be a sequence of strings"
- )
- for nsp in self.namespace_packages:
- for name in iter_distribution_names(self):
- if name.startswith(nsp+'.'): break
- else:
+
+ for attr in 'namespace_packages','eager_resources':
+ value = getattr(self,attr,None)
+ if value is not None:
+ try:
+ assert ''.join(value)!=value
+ except (TypeError,ValueError,AttributeError,AssertionError):
raise DistutilsSetupError(
- "Distribution contains no modules or packages for " +
- "namespace package %r" % nsp
+ "%r must be a list of strings (got %r)" % (attr,value)
)
+
+ for nsp in self.namespace_packages or ():
+ for name in iter_distribution_names(self):
+ if name.startswith(nsp+'.'): break
+ else:
+ raise DistutilsSetupError(
+ "Distribution contains no modules or packages for " +
+ "namespace package %r" % nsp
+ )
+
def _set_global_opts_from_features(self):
"""Add --with-X/--without-X options based on optional features"""
@@ -186,6 +195,14 @@
self.global_options = self.feature_options = go + self.global_options
self.negative_opt = self.feature_negopt = no
+
+
+
+
+
+
+
+
def _finalize_features(self):
"""Add/remove features and resolve dependencies between them"""
@@ -203,6 +220,30 @@
feature.exclude_from(self)
self._set_feature(name,0)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
def _set_feature(self,name,status):
"""Set feature's inclusion status"""
setattr(self,self._feature_attrname(name),status)
More information about the Python-checkins
mailing list