bh@0: #! /usr/bin/python2.4 bh@0: # Copyright (C) 2007 by Intevation GmbH bh@0: # Authors: bh@0: # Bernhard Herzog bh@0: # bh@0: # This program is free software under the GPL (>=v2) bh@0: # Read the file COPYING coming with the software for details. bh@0: bh@0: """Starts the tree packager""" bh@0: bh@0: import os bh@0: import logging bh@0: from optparse import OptionParser bh@0: bh@0: from treepkg.packager import AssemblyLine, Packager bh@0: from treepkg.readconfig import read_config bh@0: bh@0: def initialize_logging(): bh@0: """Initializes the logging system""" bh@0: root = logging.getLogger() bh@0: root.setLevel(logging.DEBUG) bh@0: hdlr = logging.StreamHandler() bh@0: fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s") bh@0: hdlr.setFormatter(fmt) bh@0: root.addHandler(hdlr) bh@0: bh@0: def parse_commandline(): bh@0: parser = OptionParser() bh@0: parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), bh@0: "treepkg.cfg")) bh@0: parser.add_option("--config-file") bh@0: return parser.parse_args() bh@0: bh@0: def main(): bh@0: options, args = parse_commandline() bh@0: bh@0: initialize_logging() bh@0: bh@0: treepkg_opts, assembly_line_opts = read_config(options.config_file) bh@0: packager = Packager([AssemblyLine(**opts) for opts in assembly_line_opts], bh@0: **treepkg_opts) bh@0: packager.run() bh@0: bh@0: main()