Mercurial > treepkg
comparison bin/publishstaticweb.py @ 338:28df50b267f6
Expanded the pkg_revision_template dictionary to include rules revision
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 13 Apr 2010 09:53:19 +0000 |
parents | dba1b6b825ec |
children | ef87d30468b6 |
comparison
equal
deleted
inserted
replaced
337:781074885633 | 338:28df50b267f6 |
---|---|
42 | 42 |
43 def parse_commandline(): | 43 def parse_commandline(): |
44 parser = OptionParser() | 44 parser = OptionParser() |
45 parser.set_defaults(config_file=os.path.join(treepkgcmd.topdir, | 45 parser.set_defaults(config_file=os.path.join(treepkgcmd.topdir, |
46 "staticweb.cfg")) | 46 "staticweb.cfg")) |
47 parser.set_defaults(update_cache_only=False) | |
47 parser.add_option("--config-file", | 48 parser.add_option("--config-file", |
48 help=("The configuration file. Default is staticweb.cfg")) | 49 help=("The configuration file. Default is staticweb.cfg")) |
50 parser.add_option("--update-cache-only", action="store_true", | |
51 help=("Stop after updating the cache." | |
52 " This omits the last step of the publishing" | |
53 " process")) | |
49 return parser.parse_args() | 54 return parser.parse_args() |
50 | 55 |
51 def publish_static_site(config_filename): | 56 def publish_static_site(config_filename, update_cache_only=False): |
52 config = read_config(config_filename) | 57 config = read_config(config_filename) |
53 | 58 |
54 # create web-page on build host | 59 # create web-page on build host |
55 call(cmdexpand("ssh $build_user$@$build_host $build_create" | 60 call(cmdexpand("ssh $build_user$@$build_host $build_create" |
56 " --status-template=$build_template $build_dir", | 61 " --status-template=$build_template $build_dir", |
60 ensure_directory(config["cachedir"]) | 65 ensure_directory(config["cachedir"]) |
61 call(cmdexpand("rsync -rL --delete $build_user$@$build_host:$build_dir/" | 66 call(cmdexpand("rsync -rL --delete $build_user$@$build_host:$build_dir/" |
62 " $cachedir", | 67 " $cachedir", |
63 **config)) | 68 **config)) |
64 | 69 |
65 # rsync the web pages from the local cache to the publishing host | 70 if not update_cache_only: |
66 call(cmdexpand("rsync -rL --delete $cachedir/" | 71 # rsync the web pages from the local cache to the publishing host |
67 " $publish_user$@$publish_host:$publish_dir", | 72 call(cmdexpand("rsync -rL --delete $cachedir/" |
68 **config)) | 73 " $publish_user$@$publish_host:$publish_dir", |
74 **config)) | |
69 | 75 |
70 | 76 |
71 def main(): | 77 def main(): |
72 options, args = parse_commandline() | 78 options, args = parse_commandline() |
73 publish_static_site(options.config_file) | 79 publish_static_site(options.config_file, options.update_cache_only) |
74 | 80 |
75 main() | 81 main() |