From f74028e8c47c8c128060f672ba20c0ed0b26306f Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Thu, 23 Jul 2020 17:25:33 +0000 Subject: [PATCH] Python36 compatibility drop dirs_exist_ok attribute from shutil.copytree call hard reset local repository to remove any uncomitted changes at this point Signed-off-by: Francois Andrieu --- build.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index c34e3b6..2f23a51 100755 --- a/build.py +++ b/build.py @@ -123,6 +123,7 @@ def clone_l10n(repo_name): repo_dir = os.path.dirname(os.path.abspath(__file__)) + "/l10n/" + repo_name if os.path.exists(repo_dir): + subprocess.run(['git', 'reset', "--hard", "origin"], check=True, cwd=repo_dir) subprocess.run(['git', 'pull', "--quiet"], check=True, cwd=repo_dir) else: subprocess.run(["git", "clone", url, repo_dir, "--config", @@ -138,6 +139,7 @@ def clone_translated_source(): url = "https://pagure.io/fedora-docs/translated-sources.git" if os.path.exists(repo_dir): + subprocess.run(['git', 'reset', "--hard", "origin"], check=True, cwd=repo_dir) subprocess.run(['git', 'pull', "--quiet"], check=True, cwd=repo_dir) else: subprocess.run(["git", "clone", url, repo_dir, "--config", @@ -187,7 +189,7 @@ def commit_l10n(repo_name): try: # add hooks dir_path = os.path.dirname(os.path.abspath(__file__)) - shutil.copytree(os.path.join(dir_path, '.githooks'), os.path.join(repo_dir, '.githooks'), dirs_exist_ok=True) + shutil.copytree(os.path.join(dir_path, '.githooks'), os.path.join(repo_dir, '.githooks')) shutil.copy(os.path.join(dir_path, 'check.sh'), os.path.join(repo_dir, 'check.sh')) subprocess.run(['./check.sh'], check=True, cwd=repo_dir) @@ -205,7 +207,8 @@ def commit_l10n(repo_name): else: print(" No changes to commit", flush=True) except subprocess.CalledProcessError as e: - print("** ERROR" + e.output) + print("** ERROR " + (e.output if e.output else str(e.returncode))) + def clone_sources(): """List sources repositories from antora yaml file""" -- 1.8.3.1