[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/site.py Cleanup and reinterpretation of --force.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jan 27 02:13:58 EST 2009


Log message for revision 95074:
  Cleanup and reinterpretation of --force.
  

Changed:
  U   zope.kgs/trunk/src/zope/kgs/site.py

-=-
Modified: zope.kgs/trunk/src/zope/kgs/site.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/site.py	2009-01-27 06:45:12 UTC (rev 95073)
+++ zope.kgs/trunk/src/zope/kgs/site.py	2009-01-27 07:13:58 UTC (rev 95074)
@@ -73,11 +73,9 @@
     versionDir = os.path.join(siteDir, ver)
     if os.path.exists(versionDir):
         if force:
+            logger.info('Recreating directory %s.' %versionDir)
             shutil.rmtree(versionDir)
-        else:
-            logger.error("The directory %s already exists.  Use --force to overwrite it." % versionDir)
-            return
-    os.mkdir(versionDir)
+            os.mkdir(versionDir)
 
     # Copy the KGS config file, changelog and announcement file to the version
     # directory
@@ -133,18 +131,22 @@
 
 
 parser = optparse.OptionParser()
-parser.add_option("-v","--verbose", action="store_true",
-                  dest="verbose", default=False,
-                  help="When specified, debug information is created.")
-parser.add_option("-s","--site-dir", action="store",
-                  type="string", dest="siteDir", metavar="DIR",
-                  help="The directory where the site should be generated")
-parser.add_option("-t","--template-dir", action="store",
-                  type="string", dest="templateDir", metavar="DIR",
-                  default=os.path.join(os.path.dirname(__file__), 'templates'),
-                  help="The directory where the site templates are located.")
-parser.add_option("-f","--force", action="store_true", dest="force",
-                  help="For the site to rebuild even if it is already at the latest version.")
+parser.add_option(
+    "-v","--verbose", action="store_true",
+    dest="verbose", default=False,
+    help="When specified, debug information is created.")
+parser.add_option(
+    "-s","--site-dir", action="store",
+    type="string", dest="siteDir", metavar="DIR",
+    help="The directory where the site should be generated")
+parser.add_option(
+    "-t","--template-dir", action="store",
+    type="string", dest="templateDir", metavar="DIR",
+    default=os.path.join(os.path.dirname(__file__), 'templates'),
+    help="The directory where the site templates are located.")
+parser.add_option(
+    "-f","--force", action="store_true", dest="force",
+    help="For the site to rebuild even if it is already at the latest version.")
 
 def main(args=None):
     if args is None:



More information about the Checkins mailing list