Mercurial > treepkg
annotate bin/treepkginfo.py @ 426:56f7da71d41e treepkg-status
fixed a typo
regex fails if option is empty
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Wed, 28 Jul 2010 08:33:48 +0000 |
parents | 2d31eea39f70 |
children |
rev | line source |
---|---|
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
1 #! /usr/bin/python |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
2 # Copyright (C) 2010 by Intevation GmbH |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
3 # Authors: |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
4 # Bjoern Ricks <bjoern.ricks@intevation.de> |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
5 # |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
6 # This program is free software under the GPL (>=v2) |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
7 # Read the file COPYING coming with the software for details. |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
8 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
9 """Receive the status of a treepkg""" |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
10 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
11 import treepkgcmd |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
12 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
13 from treepkg.info import status |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
14 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
15 from treepkg.options import create_parser |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
16 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
17 def parse_commandline(): |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
18 parser = create_parser() |
399
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
19 parser.set_defaults(newest=-1) |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
20 parser.add_option("--newest", type="int", |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
21 help=("Number of newest revisions to list.")) |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
399
diff
changeset
|
22 parser.add_option("--only-successful", action="store_true", |
415 | 23 help=("Show only successful builds"), dest="success") |
399
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
24 parser.add_option("--pretty", action="store_true", help=("Show XML pretty" |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
25 " output.")) |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
26 |
399
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
27 |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
28 return parser.parse_args() |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
29 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
30 def main(): |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
31 options, args = parse_commandline() |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
32 |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
399
diff
changeset
|
33 tpkginfo = status.TreepkgInfo(options.config_file, options.newest, |
415 | 34 options.success) |
399
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
35 |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
36 if options.pretty: |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
37 print tpkginfo.toxml().toprettyxml() |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
38 else: |
04310ad0063e
let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
39 print tpkginfo.toxml().toxml() |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
40 |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
41 main() |