[zpkg] SVN: zpkgtools/trunk/ add a test that setting resource
locations in <support-packages> works,
Fred L. Drake, Jr.
fdrake at gmail.com
Mon Sep 19 15:53:55 EDT 2005
Log message for revision 38532:
add a test that setting resource locations in <support-packages> works,
and fix that it did not before
(remove corresponding note from the to-do list, since this will suffice)
Changed:
U zpkgtools/trunk/doc/TODO.txt
U zpkgtools/trunk/zpkgtools/config.py
U zpkgtools/trunk/zpkgtools/tests/test_app.py
-=-
Modified: zpkgtools/trunk/doc/TODO.txt
===================================================================
--- zpkgtools/trunk/doc/TODO.txt 2005-09-19 19:12:08 UTC (rev 38531)
+++ zpkgtools/trunk/doc/TODO.txt 2005-09-19 19:53:54 UTC (rev 38532)
@@ -11,10 +11,6 @@
- Package assembler script and distribution runtime
- - It should be possible to specify a separate resource map for
- support code. This would allow the packaging and the distributed
- code to remain completely independent.
-
- The **-x** and **--exclude** options and the ``<exclude>``
configuration sections should support wildcards, similar to
resource maps.
Modified: zpkgtools/trunk/zpkgtools/config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/config.py 2005-09-19 19:12:08 UTC (rev 38531)
+++ zpkgtools/trunk/zpkgtools/config.py 2005-09-19 19:53:54 UTC (rev 38532)
@@ -153,7 +153,10 @@
value = urlparse.urljoin(url, value)
self.location_maps.append(value)
if cf.support_packages:
- self.support_packages.update(cf.support_packages)
+ for pkgname, location in cf.support_packages.iteritems():
+ if location:
+ location = urlparse.urljoin(url, location)
+ self.support_packages[pkgname] = location
self.distribution_class = cf.distribution_class
Modified: zpkgtools/trunk/zpkgtools/tests/test_app.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_app.py 2005-09-19 19:12:08 UTC (rev 38531)
+++ zpkgtools/trunk/zpkgtools/tests/test_app.py 2005-09-19 19:53:54 UTC (rev 38532)
@@ -526,6 +526,34 @@
self.assert_(os.path.isdir(package_dir))
self.assert_(isfile(package_dir, "__init__.py"))
+ def test_adding_support_code_with_location(self):
+ package_map = self.createPackageMap()
+
+ # Let's add a support package `foo`, but that contains zpkgsetup:
+ configfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ "input", "tmp.conf")
+ zpkgsetup_path = os.path.abspath(zpkgsetup.__path__[0])
+ zpkgsetup_path = urlutils.file_url(zpkgsetup_path)
+ f = open(configfile, "w")
+ self.extra_files.append(configfile)
+ print >>f, "<support-packages>"
+ print >>f, " package", zpkgsetup_path
+ print >>f, "</support-packages>"
+ f.close()
+
+ app = self.createApplication(
+ ["-C", configfile, "-m", package_map, "package"])
+ app.run()
+ # make sure the extra support code is actually present:
+ support_dir = os.path.join(app.destination, "Support")
+ package_dir = os.path.join(support_dir, "package")
+ self.assert_(os.path.isdir(package_dir))
+ self.assert_(isfile(package_dir, "__init__.py"))
+ # and that this is really zpkgsetup:
+ self.assert_(isfile(package_dir, "cfgparser.py"))
+ self.assert_(isfile(package_dir, "package.xml"))
+ self.assert_(isfile(package_dir, "urlutils.py"))
+
def test_alternate_distclass(self):
# create the distribution tree:
package_map = self.createPackageMap()
More information about the zpkg
mailing list