Mercurial > treepkg
annotate 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 |
rev | line source |
---|---|
14
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
1 #! /usr/bin/python2.4 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
2 # Copyright (C) 2007 by Intevation GmbH |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
3 # Authors: |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
4 # Bernhard Herzog <bh@intevation.de> |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
6 # This program is free software under the GPL (>=v2) |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
7 # Read the file COPYING coming with the software for details. |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
9 """Reports the current status of the tree packager""" |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 import os |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 from optparse import OptionParser |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 |
19
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
14 from treepkg.report import get_packager_group, prepare_report |
14
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
16 def parse_commandline(): |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
17 parser = OptionParser() |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 "treepkg.cfg")) |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 parser.add_option("--config-file") |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
21 return parser.parse_args() |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
22 |
19
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
23 |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
24 def report_text(group): |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
25 report = prepare_report(group) |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
26 for revno, row in report.revisions: |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
27 for col in row: |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
28 if col: |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
29 print "%s %s: %s" % (col.name, revno, col.status.desc) |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
30 if col.status.start: |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
31 print " Start:", col.status.start |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
32 print " Stop:", col.status.stop |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
33 print |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
34 |
14
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
35 def main(): |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 options, args = parse_commandline() |
19
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
37 group = get_packager_group(options.config_file) |
0cdda44240a6
Add treepkg/report.py for reporting and use it in reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents:
16
diff
changeset
|
38 report_text(group) |
14
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 |
dfd89f81e66c
Add simple status report tool. Still using the old status files
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
41 main() |