comparison bin/publishstaticweb.py @ 372:ef87d30468b6

Added the option to expose additional log files from the log directory. To enable this one can either set a build_logs value in the staticweb.cfg or call createstaticweb with the parameter --show-logs. Default behavior is to only publish the build log, although the title is now capitalized.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 21 Jun 2010 08:23:30 +0000
parents 28df50b267f6
children bccd69dedbe5
comparison
equal deleted inserted replaced
371:d0304bc2d378 372:ef87d30468b6
27 Applies os.path.expanduser and os.path.expandvars to filename 27 Applies os.path.expanduser and os.path.expandvars to filename
28 """ 28 """
29 return os.path.expandvars(os.path.expanduser(filename)) 29 return os.path.expandvars(os.path.expanduser(filename))
30 30
31 staticweb_desc = ["build_user", "build_host", "build_create", "build_template", 31 staticweb_desc = ["build_user", "build_host", "build_create", "build_template",
32 "build_logs",
32 ("build_dir", remove_trailing_slashes), 33 ("build_dir", remove_trailing_slashes),
33 "publish_user", "publish_host", 34 "publish_user", "publish_host",
34 ("publish_dir", remove_trailing_slashes), 35 ("publish_dir", remove_trailing_slashes),
35 ("cachedir", 36 ("cachedir",
36 lambda s: expand_filename(remove_trailing_slashes(s)))] 37 lambda s: expand_filename(remove_trailing_slashes(s)))]
37 38
39 #Default values for the configuration options can be set here
40 staticweb_defaults = [("build_logs", "build_log.txt.gz")]
41
38 def read_config(filename): 42 def read_config(filename):
39 parser = SafeConfigParser() 43 parser = SafeConfigParser()
44 parser.add_section("staticweb")
45 for value in staticweb_defaults:
46 parser.set("staticweb", value[0], value[1])
40 parser.read([filename]) 47 parser.read([filename])
41 return read_config_section(parser, "staticweb", staticweb_desc) 48 return read_config_section(parser, "staticweb", staticweb_desc)
42 49
43 def parse_commandline(): 50 def parse_commandline():
44 parser = OptionParser() 51 parser = OptionParser()
56 def publish_static_site(config_filename, update_cache_only=False): 63 def publish_static_site(config_filename, update_cache_only=False):
57 config = read_config(config_filename) 64 config = read_config(config_filename)
58 65
59 # create web-page on build host 66 # create web-page on build host
60 call(cmdexpand("ssh $build_user$@$build_host $build_create" 67 call(cmdexpand("ssh $build_user$@$build_host $build_create"
68 " --show-logs=$build_logs"
61 " --status-template=$build_template $build_dir", 69 " --status-template=$build_template $build_dir",
62 **config)) 70 **config))
63 71
64 # rsync the new web-pages to the local cache 72 # rsync the new web-pages to the local cache
65 ensure_directory(config["cachedir"]) 73 ensure_directory(config["cachedir"])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)