From 53330f07f2edf1856e11d181725c9d4d1865c309 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Apr 07 2020 10:31:09 +0000 Subject: Add a switch to do a local checkout of po4a Since EL7 do not have a recent enough po4a, we need that so we can build the pot file on sundries. Once this move to a newer platform, this code can be removed. --- diff --git a/.gitignore b/.gitignore index da096f6..5130981 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ l10n/ sources/ +po4a/ translated-sources/ errors.txt diff --git a/build.py b/build.py index 634de20..6e31fe6 100755 --- a/build.py +++ b/build.py @@ -26,6 +26,10 @@ def main(): help="Should we commit translated sources?") parser.add_argument("--component", required=False, help="Antora component to convert, all if unset") + parser.add_argument("--clone-po4a", action='store_true', + help="Use a local checkout of po4a") + parser.add_argument("--clone-po4a-version", default='v0.57', + help="Set the version for checkout of po4a") args = parser.parse_args() SELECTED_COMPONENT = args.component @@ -39,6 +43,9 @@ def main(): open("errors.txt", "w").close() + if args.clone_po4a: + clone_po4a(args.clone_po4a_version) + if args.clone_sources == "true": clone_sources() @@ -51,6 +58,20 @@ def main(): if args.commit_tsources == "true": commit_translated_source() + +def clone_po4a(version): + """Clone po4a, since the one in RHEL 7 is too old""" + print("Clone po4a version %s" % version) + repo_dir = '%s/po4a' % os.getcwd() + + if os.path.exists(repo_dir): + subprocess.run(['git', 'fetch'], check=True, cwd=repo_dir) + else: + subprocess.run(["git", "clone", "https://github.com/mquinson/po4a" ], check=True) + subprocess.run(['git', 'checkout', version], check=True, cwd=repo_dir) + os.environ['PATH'] = "%s/:%s" % (repo_dir, os.environ['PATH']) + os.environ['PERL5LIB'] = repo_dir + '/lib' + def call_src_to_pot(url, branch='master', basedir='/', module="ROOT"): """Call src-to-ot.sh to convert english source (adoc) content to pot files""" print("call_src_to_pot: "+url +" b:"+ branch +" bd:"+ basedir +" m:"+ module)