From: Magnus Hagander Date: Sun, 23 Sep 2018 13:46:51 +0000 (+0200) Subject: Add deploystatic commandline argument to provide githash X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=4b1ad6868170696a645f5e6919993ed408ecf8c3;p=pgeu-website.git Add deploystatic commandline argument to provide githash This will be needed when deploying off a branch, where we cannot just open a file. --- diff --git a/tools/deploystatic/deploystatic.py b/tools/deploystatic/deploystatic.py index 32d2d60..f0a262d 100755 --- a/tools/deploystatic/deploystatic.py +++ b/tools/deploystatic/deploystatic.py @@ -240,6 +240,7 @@ if __name__ == "__main__": parser.add_argument('destpath', type=str, help='Destination path') parser.add_argument('--branch', type=str, help='Deploy directly from branch') parser.add_argument('--templates', action='store_true', help='Deploy templates (except pages) and static instead of pages') + parser.add_argument('--githash', type=str, help='Use hash as githash instead of autodetecting') args = parser.parse_args() @@ -293,7 +294,10 @@ if __name__ == "__main__": # Generate a githash file with open(os.path.join(args.destpath, ".deploystatic_githash"), "w") as f: - f.write(find_git_revision(args.sourcepath)) + if args.githash: + f.write(args.githash) + else: + f.write(find_git_revision(args.sourcepath)) sys.exit(0) @@ -308,7 +312,10 @@ if __name__ == "__main__": context = load_context(source.readfile('templates/context.json')) # Fetch the current git revision if this is coming out of a git repository - context['githash'] = find_git_revision(args.sourcepath) + if args.githash: + context['githash'] = args.githash + else: + context['githash'] = find_git_revision(args.sourcepath) # Load a context that can override everything, including static hashes context.update(load_context(source.readfile('templates/context.override.json')))