changeset 290:97c17fb0ca19

Add --track-option command line option to set track-specific options. useful to e.g. specify a specific tag to package.
author Bernhard Herzog <bh@intevation.de>
date Fri, 18 Sep 2009 13:45:41 +0000
parents 433a49cacefc
children 7b00edc5bf66
files bin/runtreepkg.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bin/runtreepkg.py	Wed Sep 09 16:36:23 2009 +0000
+++ b/bin/runtreepkg.py	Fri Sep 18 13:45:41 2009 +0000
@@ -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
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)