annotate bin/starttreepkgweb.py @ 391:89ecca5d262e treepkg-status

check if config file exists to get usefull error output
author Bjoern Ricks <bricks@intevation.de>
date Thu, 08 Jul 2010 16:08:39 +0000
parents 1fcdffbeb9de
children
rev   line source
287
1fcdffbeb9de Make the #! line in the commands more portable. Use /usr/bin/python
Bernhard Herzog <bh@intevation.de>
parents: 154
diff changeset
1 #! /usr/bin/python
1fcdffbeb9de Make the #! line in the commands more portable. Use /usr/bin/python
Bernhard Herzog <bh@intevation.de>
parents: 154
diff changeset
2 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3 # Authors:
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
5 #
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6 # 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
7 # 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
8
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 """Starts the tree packager webinterface"""
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
10
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 import sys
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 import os
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 from optparse import OptionParser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 import treepkgcmd
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 from treepkg.options import create_parser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 from treepkg.web import runserver
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 def parse_commandline():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
20 parser = create_parser()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
21 parser.set_defaults(cherrypy_config=os.path.join(treepkgcmd.topdir,
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
22 "cherrypy.cfg"),
154
a30351c91a68 Make status-by-startdate.html the default template. Sorting by date is
Bernhard Herzog <bh@intevation.de>
parents: 152
diff changeset
23 status_template="status-by-startdate.html")
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
24 parser.add_option("--cherrypy-config",
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
25 help=("The cherrypy config file for the web interface."
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26 " Default cherrypy.cfg"))
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
27 parser.add_option("--status-template",
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
28 help=("The template file to use for the status page."
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
29 " Relative filenames are interpreted"
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
30 " relative to the web subdirectory."
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
31 " Default is status-by-revision.html."))
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
32 return parser.parse_args()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
33
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
34 def main():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
35 options, args = parse_commandline()
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
36 runserver(options.config_file, options.cherrypy_config,
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
37 status_template=options.status_template)
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
38
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
39 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)