[Treepkg-commits] r216 - trunk/bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 18 15:45:42 CEST 2009


Author: bh
Date: 2009-09-18 15:45:41 +0200 (Fri, 18 Sep 2009)
New Revision: 216

Modified:
   trunk/bin/runtreepkg.py
Log:
Add --track-option command line option to set track-specific options.
useful to e.g. specify a specific tag to package.


Modified: trunk/bin/runtreepkg.py
===================================================================
--- trunk/bin/runtreepkg.py	2009-09-09 16:36:23 UTC (rev 215)
+++ trunk/bin/runtreepkg.py	2009-09-18 13:45:41 UTC (rev 216)
@@ -27,8 +27,16 @@
     hdlr.setFormatter(fmt)
     root.addHandler(hdlr)
 
+def handle_track_option(option, opt_str, value, parser):
+    parsed_options = parser.values.track_options
+    track_optname, value = value.split("=", 1)
+    trackname, optname = track_optname.split(".")
+    track_options = parsed_options.setdefault(trackname, dict())
+    track_options[optname] = value
+
 def parse_commandline():
     parser = create_parser()
+    parser.set_defaults(track_options=dict())
     parser.add_option("--once", action="store_true",
                       help=("Check the packagers only once and exit afterwards."
                             " Without this option, the tree packager will"
@@ -39,6 +47,11 @@
     parser.add_option("--no-svn-update", action="store_true",
                       help=("Do not update the SVN workingcopy before"
                             " attempting to package."))
+    parser.add_option("--track-option", action="callback", type="string",
+                      callback=handle_track_option,
+                      help=("Sets a track-specific option."
+                            " The argument should be of the form"
+                            " TRACKNAME.OPTION=VALUE"))
     return parser.parse_args()
 
 def main():
@@ -57,6 +70,8 @@
         name = opts["name"]
         opts["do_build"] = name in selected_tracks
         selected_tracks.discard(name)
+        if name in options.track_options:
+            opts.update(options.track_options[name])
     for name in selected_tracks:
         print >>sys.stderr, "No package track found named %r" % name
 



More information about the Treepkg-commits mailing list