comparison runtreepkg.py @ 25:2bfb84bc4350

runtreepkg.py: add option --once and a way to run specific packagers
author Bernhard Herzog <bh@intevation.de>
date Wed, 14 Mar 2007 11:48:45 +0100
parents 574506a022f6
children 206d63ee310e
comparison
equal deleted inserted replaced
23:7510173b68be 25:2bfb84bc4350
26 26
27 def parse_commandline(): 27 def parse_commandline():
28 parser = OptionParser() 28 parser = OptionParser()
29 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), 29 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__),
30 "treepkg.cfg")) 30 "treepkg.cfg"))
31 parser.add_option("--config-file") 31 parser.add_option("--config-file",
32 help=("The tree packager config file."
33 " Default treepkg.cfg"))
34 parser.add_option("--once", action="store_true",
35 help=("Check the packagers only once and exit afterwards."
36 " Without this option, the tree packager will"
37 " check periodically."))
32 return parser.parse_args() 38 return parser.parse_args()
33 39
34 def main(): 40 def main():
35 options, args = parse_commandline() 41 options, args = parse_commandline()
36 42
37 initialize_logging() 43 initialize_logging()
38 44
39 treepkg_opts, packager_opts = read_config(options.config_file) 45 treepkg_opts, packager_opts = read_config(options.config_file)
46 if args:
47 packager_opts = [opts for opts in packager_opts if opts["name"] in args]
48 # check whether we got all of the names in args:
49 for opts in packager_opts:
50 name = opts["name"]
51 if name in args:
52 args.remove(name)
53 for name in args:
54 print >>sys.stderr, "No package lines found named %r" % name
40 group = PackagerGroup([create_package_line(**opts) 55 group = PackagerGroup([create_package_line(**opts)
41 for opts in packager_opts], 56 for opts in packager_opts],
42 **treepkg_opts) 57 **treepkg_opts)
43 group.run() 58 if options.once:
59 group.check_package_lines()
60 else:
61 group.run()
44 62
45 main() 63 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)