[Zope-CVS] CVS: Packages/zpkgtools/bin - zpkg:1.5

Fred L. Drake, Jr. fred at zope.com
Fri Mar 12 15:46:16 EST 2004


Update of /cvs-repository/Packages/zpkgtools/bin
In directory cvs.zope.org:/tmp/cvs-serv29089

Modified Files:
	zpkg 
Log Message:
select the specific build method based on the type of the resource


=== Packages/zpkgtools/bin/zpkg 1.4 => 1.5 ===
--- Packages/zpkgtools/bin/zpkg:1.4	Fri Mar 12 15:35:16 2004
+++ Packages/zpkgtools/bin/zpkg	Fri Mar 12 15:46:15 2004
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2.3
+#!/usr/bin/env python2.3
 
 import optparse
 import os
@@ -24,6 +24,7 @@
 
 from zpkgtools import config
 from zpkgtools import cvsloader
+from zpkgtools import locationmap
 from zpkgtools import publication
 from zpkgtools import setup
 from zpkgtools.include import InclusionProcessor
@@ -34,7 +35,8 @@
     def __init__(self, options, resource, program):
         self.ip = None
         self.options = options
-        self.resource = resource
+        self.resource = locationmap.normalizeResourceId(resource)
+        self.resource_type, self.resource_name = self.resource.split(":", 1)
         # Create a new directory for all temporary files to go in:
         self.tmpdir = tempfile.mkdtemp(prefix=program + "-")
         tempfile.tempdir = self.tmpdir
@@ -52,10 +54,9 @@
         # This could be either a package distribution or a collection
         # distribution; it's the former if there's an __init__.py in
         # the source directory.
-        if os.path.exists(os.path.join(self.source, "__init__.py")):
-            self.buildPackageDistribution()
-        else:
-            self.buildCollectionDistribution()
+        name = "build%sDistribution" % self.resource_type.capitalize()
+        method = getattr(self, name)
+        method()
         self.generateSetup()
 
     def buildPackageDistribution(self):




More information about the Zope-CVS mailing list