Bug 1949573 - [lint] Capture output when setting up l10n repo, r=linter-reviewers,sylvestre

Differential Revision: https://phabricator.services.mozilla.com/D239010
This commit is contained in:
Andrew Halberstadt
2025-02-21 15:42:58 +00:00
parent a933f481dd
commit 85b95c3b55

View File

@@ -3,8 +3,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import subprocess
from datetime import datetime, timedelta
from subprocess import check_call
from compare_locales import parser
from compare_locales.lint.linter import L10nLinter
@@ -112,10 +112,20 @@ def source_repo_setup(**lint_args):
if "GIT_INDEX_FILE" in os.environ:
os.environ.pop("GIT_INDEX_FILE")
kwargs = {
"check": False,
"stdout": subprocess.PIPE,
"stderr": subprocess.STDOUT,
}
if os.path.exists(gs):
check_call([git, "pull", L10N_SOURCE_REPO], cwd=gs)
proc = subprocess.run([git, "pull", L10N_SOURCE_REPO], cwd=gs, **kwargs)
else:
check_call([git, "clone", L10N_SOURCE_REPO, gs])
proc = subprocess.run([git, "clone", L10N_SOURCE_REPO, gs], **kwargs)
if proc.returncode != 0:
lint_args["log"].error(f"Failed to pull {L10N_SOURCE_REPO}:\n{proc.stdout}")
return 1
with open(marker, "w") as fh:
fh.flush()