annotate createstaticweb.py @ 77:f0aa5a8af056

web: create cachedir if it doesn't exist
author Bernhard Herzog <bh@intevation.de>
date Tue, 17 Apr 2007 13:06:59 +0200
parents 517253fa987f
children
rev   line source
65
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python2.4
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Copyright (C) 2007 by Intevation GmbH
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Authors:
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 #
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8
67
517253fa987f fix typo in doc-string
Bernhard Herzog <bh@intevation.de>
parents: 65
diff changeset
9 """Creates a static web-site with a status report"""
65
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import os
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 from optparse import OptionParser
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14 from treepkg.web import Status
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16 def parse_commandline():
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17 parser = OptionParser()
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18 dirname = os.path.dirname(__file__)
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 parser.set_defaults(config_file=os.path.join(dirname, "treepkg.cfg"))
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20 parser.add_option("--config-file",
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 help=("The tree packager config file."
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22 " Default treepkg.cfg"))
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 return parser.parse_args()
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 def create_static_site(treepkg_config, destdir):
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 status = Status(treepkg_config=treepkg_config)
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27 status.create_static_site(destdir)
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 def main():
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 options, args = parse_commandline()
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 create_static_site(options.config_file, args[0])
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32
bebe06ff4bd6 add createstaticweb.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)