[Checkins] SVN: grokproject/trunk/ Merge jw-fix-125817 branch - Each of the interactive questions

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Nov 5 04:20:20 EST 2007


Log message for revision 81519:
  Merge jw-fix-125817 branch - Each of the interactive questions 
  can now be set with an commandline option.
  

Changed:
  U   grokproject/trunk/README.txt
  U   grokproject/trunk/TODO.txt
  U   grokproject/trunk/grokproject/__init__.py

-=-
Modified: grokproject/trunk/README.txt
===================================================================
--- grokproject/trunk/README.txt	2007-11-05 04:32:21 UTC (rev 81518)
+++ grokproject/trunk/README.txt	2007-11-05 09:20:19 UTC (rev 81519)
@@ -25,7 +25,8 @@
 0.6.1 (unreleased)
 ------------------
 
-* ...
+* Each of the interactive questions can now be set with an commandline
+  option.
 
 0.6 (2007-10-10)
 ----------------

Modified: grokproject/trunk/TODO.txt
===================================================================
--- grokproject/trunk/TODO.txt	2007-11-05 04:32:21 UTC (rev 81518)
+++ grokproject/trunk/TODO.txt	2007-11-05 09:20:19 UTC (rev 81519)
@@ -1,6 +1,3 @@
 * zc.buildout has a logging initialization bug (it doesn't tear down
   the logging handler, so subsequent logging calls are multiplied).
   See https://bugs.launchpad.net/zc.buildout/+bug/125729.
-
-* Allow values to be provided thru command line arguments
-  See https://bugs.launchpad.net/grok/+bug/125817.

Modified: grokproject/trunk/grokproject/__init__.py
===================================================================
--- grokproject/trunk/grokproject/__init__.py	2007-11-05 04:32:21 UTC (rev 81518)
+++ grokproject/trunk/grokproject/__init__.py	2007-11-05 09:20:19 UTC (rev 81519)
@@ -55,11 +55,18 @@
                       "hierarchy).")
     parser.add_option('--newer', action="store_true", dest="newest",
                       default=False, help="Check for newer versions of packages.")
+    parser.add_option('-v', '--verbose', action="store_true", dest="verbose",
+                      default=False, help="Be verbose.")
     parser.add_option(
         '--version-info-url', dest="version_info_url", default=None,
         help="The URL to a *.cfg file containing a [versions] section.")
-    parser.add_option('-v', '--verbose', action="store_true", dest="verbose",
-                      default=False, help="Be verbose.")
+
+    # Options that override the interactive part of filling the templates.
+    for var in GrokProject.vars:
+        parser.add_option(
+            '--'+var.name.replace('_', '-'), dest=var.name,
+            help=var.description)
+
     options, args = parser.parse_args()
     if len(args) != 1:
         parser.print_usage()
@@ -83,12 +90,18 @@
     else:
         extra_args.append('newest=false')
 
+    # Process the options that override the interactive part of filling
+    # the templates.
+    for var in GrokProject.vars:
+        supplied_value = getattr(options, var.name)
+        if supplied_value is not None:
+            extra_args.append('%s=%s' % (var.name, supplied_value))
+
     version_info_url = options.version_info_url
     if not version_info_url:
         info = urllib.urlopen(VERSIONINFO_INFO_URL).read().strip()
         version_info_url = urlparse.urljoin(VERSIONINFO_INFO_URL, info)
     extra_args.append('extends=' + version_info_url)
-
     exit_code = runner.run(option_args + ['-t', 'grokproject', project]
                            + extra_args)
     # TODO exit_code



More information about the Checkins mailing list