[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - setup.py:1.4

Fred L. Drake, Jr. fred at zope.com
Mon Mar 15 16:45:54 EST 2004


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

Modified Files:
	setup.py 
Log Message:
internal helper methods don't need the camel-casing; using underscores
keeps the names readable and makes it clear these aren't API


=== Packages/zpkgtools/zpkgtools/setup.py 1.3 => 1.4 ===
--- Packages/zpkgtools/zpkgtools/setup.py:1.3	Sat Mar 13 00:32:00 2004
+++ Packages/zpkgtools/zpkgtools/setup.py	Mon Mar 15 16:45:53 2004
@@ -46,13 +46,13 @@
             import distutils.core
             distutils.core.setup(**kwargs)
 
-    def loadMetadata(self, path):
+    def load_metadata(self, path):
         f = open(path, "rU")
         publication.load(f, metadata=self)
         if self.platforms:
             self.platforms = ", ".join(self.platforms)
 
-    def scanPackage(self, name, directory):
+    def scan_package(self, name, directory):
         files = os.listdir(directory)
         # need to load package-specific data here as well
         for fn in files:
@@ -65,32 +65,32 @@
                 if os.path.isfile(init_py):
                     pkgname = "%s.%s" % (name, fn)
                     self.packages.append(pkgname)
-                    self.scanPackage(pkgname, path)
+                    self.scan_package(pkgname, path)
                 else:
                     # an ordinary directory
-                    self.scanDirectory(name, path, fn)
+                    self.scan_directory(name, path, fn)
             else:
-                self.addPackageFile(name, fn)
+                self.add_package_file(name, fn)
 
-    def scanDirectory(self, pkgname, directory, reldir):
+    def scan_directory(self, pkgname, directory, reldir):
         """Scan a data directory, adding files to package_data."""
         for fn in os.listdir(directory):
             path = os.path.join(directory, fn)
             if os.path.isdir(path):
-                self.scanDirectory(pkgname,
-                                   os.path.join(directory, fn),
-                                   posixpath.join(reldir, fn))
+                self.scan_directory(pkgname,
+                                    os.path.join(directory, fn),
+                                    posixpath.join(reldir, fn))
             else:
                 fnbase, ext = os.path.splitext(fn)
                 if ext in (".pyc", ".pyo", ".so", ".sl", ".pyd"):
                     continue
-                self.addPackageFile(pkgname, posixpath.join(reldir, fn))
+                self.add_package_file(pkgname, posixpath.join(reldir, fn))
 
-    def addPackageDir(self, pkgname, reldir):
+    def add_package_dir(self, pkgname, reldir):
         if pkgname.replace(".", posixpath.sep) != reldir:
             self.package_dir[pkgname] = reldir
 
-    def addPackageFile(self, pkgname, relfn):
+    def add_package_file(self, pkgname, relfn):
         L = self.package_data.setdefault(pkgname, [])
         L.append(relfn)
 
@@ -100,10 +100,10 @@
     def __init__(self, pkgname, version, setup_file):
         SetupContext.__init__(self, pkgname, version, setup_file)
         self.packages.append(pkgname)
-        self.addPackageDir(pkgname, pkgname)
-        self.loadMetadata(
+        self.load_metadata(
             os.path.join(self._working_dir, pkgname, "PUBLICATION.txt"))
-        self.scanPackage(
+        self.add_package_dir(pkgname, pkgname)
+        self.scan_package(
             pkgname, os.path.join(self._working_dir, pkgname))
 
 
@@ -111,5 +111,5 @@
 
     def __init__(self, pkgname, version, setup_file):
         SetupContext.__init__(self, pkgname, version, setup_file)
-        self.loadMetadata(os.path.join(self._working_dir,
-                                       "PUBLICATION.txt"))
+        self.load_metadata(os.path.join(self._working_dir,
+                                        "PUBLICATION.txt"))




More information about the Zope-CVS mailing list