Mercurial > treepkg > treepkg
annotate treepkg/options.py @ 566:1b3b08bbe27a
Accept also --config for --config-file
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 02 Sep 2011 10:41:14 +0000 |
parents | 9a602d8eaa60 |
children |
rev | line source |
---|---|
78
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2007 by Intevation GmbH |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 # Authors: |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
3 # Bernhard Herzog <bh@intevation.de> |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 # |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 # This program is free software under the GPL (>=v2) |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
6 # Read the file COPYING coming with the software for details. |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 """Common command line options""" |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 import os |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 from optparse import OptionParser |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
14 def create_parser(): |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 """Creates an OptionParser with common tree packager options""" |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
16 parser = OptionParser() |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
17 dirname = os.path.dirname(__file__) |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
18 parser.set_defaults(config_file=os.path.join(dirname, os.pardir, |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 "treepkg.cfg")) |
566
1b3b08bbe27a
Accept also --config for --config-file
Bjoern Ricks <bricks@intevation.de>
parents:
78
diff
changeset
|
20 parser.add_option("--config-file", "--config", dest="config_file", |
78
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 help=("The tree packager config file." |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 " Default treepkg.cfg")) |
9a602d8eaa60
initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
23 return parser |