[Zope-CVS] SVN: zpkgtools/trunk/zpkg allow enabling collection of
dependencies from the configuration file
Fred L. Drake, Jr.
fdrake at gmail.com
Fri Aug 5 16:39:10 EDT 2005
Log message for revision 37746:
allow enabling collection of dependencies from the configuration file
Changed:
U zpkgtools/trunk/zpkgsetup/package.py
U zpkgtools/trunk/zpkgsetup/setup.py
U zpkgtools/trunk/zpkgtools/app.py
U zpkgtools/trunk/zpkgtools/config.py
U zpkgtools/trunk/zpkgtools/tests/test_config.py
-=-
Modified: zpkgtools/trunk/zpkgsetup/package.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/package.py 2005-08-05 19:54:01 UTC (rev 37745)
+++ zpkgtools/trunk/zpkgsetup/package.py 2005-08-05 20:39:09 UTC (rev 37746)
@@ -75,6 +75,17 @@
PACKAGE_CONF = "SETUP.cfg"
+class Header(object):
+ """Information about a header file and the package that provides it."""
+
+ def __init__(self, package, path):
+ self.package = package
+ self.path = path
+
+ def __repr__(self):
+ return "<Header(%r, %r)>" % (self.package, self.path)
+
+
def loadPackageInfo(pkgname, directory, reldir):
"""Load package information for a Python package.
@@ -93,6 +104,8 @@
pkginfo = read_package_info(directory, reldir)
pkginfo.extensions = [create_extension(ext, pkgname, reldir)
for ext in pkginfo.extension]
+ pkginfo.package_headers = [Header(pkgname, path)
+ for path in pkginfo.header]
return pkginfo
Modified: zpkgtools/trunk/zpkgsetup/setup.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/setup.py 2005-08-05 19:54:01 UTC (rev 37745)
+++ zpkgtools/trunk/zpkgsetup/setup.py 2005-08-05 20:39:09 UTC (rev 37746)
@@ -66,6 +66,7 @@
self.packages = []
self.package_data = {}
self.package_dir = {}
+ self.package_headers = []
self.ext_modules = []
self.scripts = []
self.platforms = None
@@ -223,6 +224,7 @@
self.add_package_file(pkgname, posixpath.join(reldir, fn))
def scan_basic(self, pkginfo):
+ self.package_headers.extend(pkginfo.package_headers)
self.scripts.extend(pkginfo.script)
if pkginfo.data_files:
if self.data_files:
Modified: zpkgtools/trunk/zpkgtools/app.py
===================================================================
--- zpkgtools/trunk/zpkgtools/app.py 2005-08-05 19:54:01 UTC (rev 37745)
+++ zpkgtools/trunk/zpkgtools/app.py 2005-08-05 20:39:09 UTC (rev 37746)
@@ -78,6 +78,8 @@
cf.loadPath(path)
cf.finalize()
self.locations = cf.locations
+ if cf.collect_dependencies:
+ self.options.collect = True
# XXX Hack: This should be part of BuilderApplication
if options.include_support_code is None:
Modified: zpkgtools/trunk/zpkgtools/config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/config.py 2005-08-05 19:54:01 UTC (rev 37745)
+++ zpkgtools/trunk/zpkgtools/config.py 2005-08-05 20:39:09 UTC (rev 37746)
@@ -51,6 +51,7 @@
SCHEMA = cfgparser.Schema(
({"resource-map": non_empty_string,
"include-support-code": boolean,
+ "collect-dependencies": boolean,
}, [], None),
)
@@ -69,6 +70,7 @@
def __init__(self):
"""Initialize a new `Configuration` object."""
+ self.collect_dependencies = False
self.location_maps = []
self.locations = locationmap.LocationMap()
self.include_support_code = True
@@ -113,11 +115,18 @@
for value in cf.resource_map:
value = urlparse.urljoin(base, value)
self.location_maps.append(value)
+ # include-support-code
if len(cf.include_support_code) > 1:
raise cfgparser.ConfigurationError(
"include-support-code can be specified at most once")
if cf.include_support_code:
self.include_support_code = cf.include_support_code[0]
+ # collect-dependencies
+ if len(cf.collect_dependencies) > 1:
+ raise cfgparser.ConfigurationError(
+ "include-support-code can be specified at most once")
+ if cf.collect_dependencies:
+ self.collect_dependencies = cf.collect_dependencies[0]
def defaultConfigurationPath():
Modified: zpkgtools/trunk/zpkgtools/tests/test_config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_config.py 2005-08-05 19:54:01 UTC (rev 37745)
+++ zpkgtools/trunk/zpkgtools/tests/test_config.py 2005-08-05 20:39:09 UTC (rev 37746)
@@ -39,6 +39,7 @@
def test_constructor(self):
cf = config.Configuration()
self.assert_(cf.include_support_code)
+ self.assert_(not cf.collect_dependencies)
self.assertEqual(len(cf.locations), 0)
self.assertEqual(len(cf.location_maps), 0)
@@ -60,6 +61,11 @@
self.assertRaises(cfgparser.ConfigurationError,
self.load_text, "resource-map \n")
+ # collect-dependencies too many times
+ self.assertRaises(cfgparser.ConfigurationError,
+ self.load_text, ("collect-dependencies false\n"
+ "collect-dependencies false\n"))
+
# include-support-code too many times
self.assertRaises(cfgparser.ConfigurationError,
self.load_text, ("include-support-code false\n"
More information about the Zope-CVS
mailing list