Marco Ricci
Automatically check and build the translations on master via hatch-gettext
Marco Ricci commited 4b51736 at 2025-02-11 16:30:37
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2025 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: Zlib
# ruff: noqa: S404,S603,S607
"""Run various quality control checks automatically.
Distinguish between the master branch and other branches: run the full
test suite and build the translations and the documentation only on the
master branch, otherwise use only a reduced set of test environments and
don't build anything. In both cases, run the linter, the formatter, and
the type checker.
If we are currently in a Stacked Git patch queue, do not run any tests,
do not run the type checker and do not build anything. These all slow
down patch refreshing to a grinding halt, and will be checked afterwards
anyway when merging the patch queue back into the master branch. Stick
to formatting and linting only.
"""
import hashlib
import os
import pathlib
import subprocess
import sys
BLOCK_SIZE = 4096
envs = ['3.9', '3.11', '3.13', 'pypy3.10']
opts = ['-py', ','.join(envs)]
current_branch = (
os.getenv('GIT_CURRENT_BRANCH')
or subprocess.run(
['git', 'branch', '--show-current'],
capture_output=True,
text=True,
check=False,
).stdout.strip()
)
# We use rev-parse to check for Stacked Git's metadata tracking branch,
# instead of checking `stg top` or similar, because we also want the
# first `stg new` or `stg import` to correctly detect that we are
# working on a patch queue.
is_stgit_patch = bool(
subprocess.run(
[
'git',
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX