comparison runtreepkg.py @ 49:38d66dc6a1e5

merge
author Bernhard Herzog <bh@intevation.de>
date Mon, 02 Apr 2007 20:48:25 +0200
parents 206d63ee310e
children 78cf5f6778ec
comparison
equal deleted inserted replaced
48:aed3869ac04a 49:38d66dc6a1e5
6 # This program is free software under the GPL (>=v2) 6 # This program is free software under the GPL (>=v2)
7 # Read the file COPYING coming with the software for details. 7 # Read the file COPYING coming with the software for details.
8 8
9 """Starts the tree packager""" 9 """Starts the tree packager"""
10 10
11 import sys
11 import os 12 import os
12 import logging 13 import logging
13 from optparse import OptionParser 14 from optparse import OptionParser
14 15
15 from treepkg.packager import create_package_line, PackagerGroup 16 from treepkg.packager import create_package_line, PackagerGroup
26 27
27 def parse_commandline(): 28 def parse_commandline():
28 parser = OptionParser() 29 parser = OptionParser()
29 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), 30 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__),
30 "treepkg.cfg")) 31 "treepkg.cfg"))
31 parser.add_option("--config-file") 32 parser.add_option("--config-file",
33 help=("The tree packager config file."
34 " Default treepkg.cfg"))
35 parser.add_option("--once", action="store_true",
36 help=("Check the packagers only once and exit afterwards."
37 " Without this option, the tree packager will"
38 " check periodically."))
32 return parser.parse_args() 39 return parser.parse_args()
33 40
34 def main(): 41 def main():
35 options, args = parse_commandline() 42 options, args = parse_commandline()
36 43
37 initialize_logging() 44 initialize_logging()
38 45
39 treepkg_opts, packager_opts = read_config(options.config_file) 46 treepkg_opts, packager_opts = read_config(options.config_file)
40 group = PackagerGroup([create_package_line(**opts) 47
41 for opts in packager_opts], 48 if args:
42 **treepkg_opts) 49 packager_opts = [opts for opts in packager_opts if opts["name"] in args]
43 group.run() 50 # check whether we got all of the names in args:
51 for opts in packager_opts:
52 name = opts["name"]
53 if name in args:
54 args.remove(name)
55 for name in args:
56 print >>sys.stderr, "No package lines found named %r" % name
57
58 if packager_opts:
59 group = PackagerGroup([create_package_line(**opts)
60 for opts in packager_opts],
61 **treepkg_opts)
62 if options.once:
63 group.check_package_lines()
64 else:
65 group.run()
44 66
45 main() 67 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)