Mercurial > treepkg
comparison reportstatus.py @ 19:0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 13 Mar 2007 19:21:37 +0100 |
parents | 7c55f3879c4d |
children |
comparison
equal
deleted
inserted
replaced
18:d5c24cfce05e | 19:0cdda44240a6 |
---|---|
9 """Reports the current status of the tree packager""" | 9 """Reports the current status of the tree packager""" |
10 | 10 |
11 import os | 11 import os |
12 from optparse import OptionParser | 12 from optparse import OptionParser |
13 | 13 |
14 from treepkg.packager import create_package_line, PackagerGroup | 14 from treepkg.report import get_packager_group, prepare_report |
15 from treepkg.readconfig import read_config | |
16 | 15 |
17 def parse_commandline(): | 16 def parse_commandline(): |
18 parser = OptionParser() | 17 parser = OptionParser() |
19 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), | 18 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), |
20 "treepkg.cfg")) | 19 "treepkg.cfg")) |
21 parser.add_option("--config-file") | 20 parser.add_option("--config-file") |
22 return parser.parse_args() | 21 return parser.parse_args() |
23 | 22 |
23 | |
24 def report_text(group): | |
25 report = prepare_report(group) | |
26 for revno, row in report.revisions: | |
27 for col in row: | |
28 if col: | |
29 print "%s %s: %s" % (col.name, revno, col.status.desc) | |
30 if col.status.start: | |
31 print " Start:", col.status.start | |
32 print " Stop:", col.status.stop | |
33 print | |
34 | |
24 def main(): | 35 def main(): |
25 options, args = parse_commandline() | 36 options, args = parse_commandline() |
37 group = get_packager_group(options.config_file) | |
38 report_text(group) | |
26 | 39 |
27 treepkg_opts, packager_opts = read_config(options.config_file) | |
28 group = PackagerGroup([create_package_line(**opts) | |
29 for opts in packager_opts], | |
30 **treepkg_opts) | |
31 for line in group.get_package_lines(): | |
32 for revision in line.get_revisions(): | |
33 print line.name, revision.revision, revision.status.status | |
34 print " start:", revision.status.start | |
35 print " stop:", revision.status.stop | |
36 | 40 |
37 main() | 41 main() |