[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - config.py:1.7

Fred L. Drake, Jr. fred at zope.com
Fri Apr 2 03:32:35 EST 2004


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

Modified Files:
	config.py 
Log Message:
add docstrings


=== Packages/zpkgtools/zpkgtools/config.py 1.6 => 1.7 ===
--- Packages/zpkgtools/zpkgtools/config.py:1.6	Tue Mar 30 18:49:54 2004
+++ Packages/zpkgtools/zpkgtools/config.py	Fri Apr  2 03:32:35 2004
@@ -11,12 +11,16 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Configuration support for zpkg.
+"""Configuration support for **zpkg**.
 
 The syntax of the configuration files is incredibly simple, but is
-intended to be a strict subset of the ZConfig.  This allows us to
-switch to ZConfig in the future if we decide the dependency is worth
-it.
+intended to be a strict subset of the `ZConfig`_.  This allows us to
+switch to `ZConfig`_ in the future if we decide the dependency is
+worth it.
+
+.. _ZConfig:  http://www.zope.org/Members/fdrake/zconfig/
+
+:undocumented: boolean non_empty_string \*_STRINGS
 """
 
 import os
@@ -50,19 +54,37 @@
 
 
 class Configuration:
-    """Configuration settings for zpkg."""
+    """Configuration settings for **zpkg**.
+
+    :Ivariables:
+      - `locations`: Mapping of resource identifiers to location URLs.
+
+      - `location_maps`: List of location maps to load.
+
+      - `include_support_code`: Indicates whether support code should
+        be included in distributions.
+    """
 
     def __init__(self):
+        """Initialize a new `Configuration` object."""
         self.location_maps = []
         self.locations = locationmap.LocationMap()
         self.include_support_code = True
 
     def finalize(self):
+        """Load the location maps into `locations`."""
         for loc in self.location_maps:
             self.locations = locationmap.fromPathOrUrl(loc,
                                                        mapping=self.locations)
 
     def loadPath(self, path):
+        """Load configuration from a file.
+
+        :param path: Path of the file to load.
+
+        :raises IOError: If the `path` cannot be found, is not a file,
+          or cannot be read.
+        """
         basedir = os.path.dirname(path)
         f = open(path, "rU")
         try:
@@ -71,6 +93,19 @@
             f.close()
 
     def loadStream(self, f, path, basedir):
+        """Load configuration from an open stream.
+
+        :Parameters:
+          - `f`: The stream, which must have been opened for reading
+            in text mode.
+
+          - `path`: Path with which to identify the stream in error
+            messages.
+
+          - `basedir`: Base directory with which to join relative
+            paths found in the configuration file.
+
+        """
         p = cfgparser.Parser(f, path, SCHEMA)
         cf = p.load()
         for value in cf.resource_map:
@@ -88,9 +123,12 @@
 
 
 def defaultConfigurationPath():
-    """Return the path name of the zpkg configuration file.
+    """Return the path name of the configuration file.
 
     This returns different things for Windows and POSIX systems.
+
+    :return: Path to the default configuration file.  The directory or
+      file may not exist.
     """
     zpkgdir = "zpkg"
     if os.name == "posix":




More information about the Zope-CVS mailing list