[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - __init__.py:1.4 app.py:1.37 cvsloader.py:1.17 svnloader.py:1.5

Fred L. Drake, Jr. fred at zope.com
Tue Apr 27 11:13:53 EDT 2004


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

Modified Files:
	__init__.py app.py cvsloader.py svnloader.py 
Log Message:
give CvsLoadingError and SubversionLoadingError a common base class so the
top-level application does not need to care about the type of revision control
being used (and will properly detect errors loading from Subversion)


=== Packages/zpkgtools/zpkgtools/__init__.py 1.3 => 1.4 ===
--- Packages/zpkgtools/zpkgtools/__init__.py:1.3	Fri Apr  2 01:30:05 2004
+++ Packages/zpkgtools/zpkgtools/__init__.py	Tue Apr 27 11:13:52 2004
@@ -27,3 +27,20 @@
 
 class Error(Exception):
     """Base class for exceptions raised by zpkgtools."""
+
+
+class LoadingError(Error):
+    """Raised when there was some error loading from revision control.
+
+    :ivar url: Revision control URL.
+    :type url: str
+
+    :ivar exitcode: Return code of an external process.
+    :type exitcode: int
+    """
+
+    def __init__(self, url, exitcode):
+        self.exitcode = exitcode
+        self.url = url
+        Error.__init__(self, ("could not load from %s (exit code %d)"
+                              % (url, exitcode)))


=== Packages/zpkgtools/zpkgtools/app.py 1.36 => 1.37 ===
--- Packages/zpkgtools/zpkgtools/app.py:1.36	Fri Apr 23 15:56:12 2004
+++ Packages/zpkgtools/zpkgtools/app.py	Tue Apr 27 11:13:52 2004
@@ -25,7 +25,6 @@
 import zpkgtools
 
 from zpkgtools import config
-from zpkgtools import cvsloader
 from zpkgtools import dependencies
 from zpkgtools import include
 from zpkgtools import loader
@@ -116,7 +115,7 @@
         specs.collection.cook()
         try:
             self.ip.createDistributionTree(pkgdest, specs.collection)
-        except cvsloader.CvsLoadingError, e:
+        except zpkgtools.LoadingError, e:
             self.error(str(e))
         self.ip.addIncludes(self.destination, specs.distribution)
         pkgdir = os.path.join(self.destination, pkgname)
@@ -270,7 +269,7 @@
     def add_collection_component(self, name, destination, spec):
         try:
             self.ip.createDistributionTree(destination, spec)
-        except cvsloader.CvsLoadingError, e:
+        except zpkgtools.LoadingError, e:
             self.error(str(e))
         # load package information and generate setup.cfg
         pkginfo = package.loadCollectionInfo(destination)
@@ -281,7 +280,7 @@
         pkgdest = os.path.join(destination, name)
         try:
             self.ip.createDistributionTree(pkgdest, spec)
-        except cvsloader.CvsLoadingError, e:
+        except zpkgtools.LoadingError, e:
             self.error(str(e))
         # load package information and generate setup.cfg
         pkginfo = package.loadPackageInfo(name, pkgdest, name)
@@ -521,7 +520,7 @@
                 self.build_distribution()
                 if self.options.include_support_code:
                     self.include_support_code()
-            except cvsloader.CvsLoadingError, e:
+            except zpkgtools.LoadingError, e:
                 self.error(str(e), e.exitcode)
             self.create_manifest(self.destination)
             self.create_tarball()


=== Packages/zpkgtools/zpkgtools/cvsloader.py 1.16 => 1.17 ===
--- Packages/zpkgtools/zpkgtools/cvsloader.py:1.16	Wed Apr 21 17:01:48 2004
+++ Packages/zpkgtools/zpkgtools/cvsloader.py	Tue Apr 27 11:13:52 2004
@@ -22,22 +22,19 @@
 import urllib
 import urlparse
 
-from zpkgtools import Error
+from zpkgtools import Error, LoadingError
 
 
-class CvsLoadingError(Error):
+class CvsLoadingError(LoadingError):
     """Raised when there was some error loading from CVS.
 
-    :Ivariables:
-      - `cvsurl`: Parsed cvs: URL object.
-      - `exitcode`: Return code of the CVS process.
+    :ivar cvsurl: Parsed ``cvs:`` URL object.
+    :type cvsurl: `CvsUrl`
     """
 
     def __init__(self, cvsurl, exitcode):
+        LoadingError.__init__(self, cvsurl.getUrl(), exitcode)
         self.cvsurl = cvsurl
-        self.exitcode = exitcode
-        Error.__init__(self, ("could not load from %s (cvs exit code %d)"
-                              % (cvsurl.getUrl(), exitcode)))
 
 
 _cvs_url_match = re.compile(


=== Packages/zpkgtools/zpkgtools/svnloader.py 1.4 => 1.5 ===
--- Packages/zpkgtools/zpkgtools/svnloader.py:1.4	Tue Apr 27 10:35:02 2004
+++ Packages/zpkgtools/zpkgtools/svnloader.py	Tue Apr 27 11:13:52 2004
@@ -23,22 +23,11 @@
 import urllib
 import urlparse
 
-from zpkgtools import Error
+from zpkgtools import LoadingError
 
 
-class SubversionLoadingError(Error):
-    """Raised when there was some error loading from Subversion.
-
-    :Ivariables:
-      - `url`: Subversion URL.
-      - `exitcode`: Return code of the Subversion process.
-    """
-
-    def __init__(self, url, exitcode):
-        self.url = cvsurl
-        self.exitcode = exitcode
-        Error.__init__(self, ("could not load from %s (svn exit code %d)"
-                              % (url, exitcode)))
+class SubversionLoadingError(LoadingError):
+    """Raised when there was some error loading from Subversion."""
 
 
 if sys.platform[:3].lower() == "win":




More information about the Zope-CVS mailing list