Fully working CI (#118)

Ça commence à marcher, par contre on a un souci avec un :rfc: dans pospell :

    <rst-doc>:1: (ERROR/3) RFC number must be a number greater than or equal to 1; "la spécification correspondante <5424#section-6>" is invalid. while parsing: La :rfc:`5424` requiert qu’un message Unicode soit envoyé à un démon *syslog* sous la forme d’un ensemble d’octets ayant la structure suivante : un composant ASCII pur facultatif, suivi d’une marque d’ordre d’octet (*BOM* pour *Byte Order Mark* en anglais) UTF-8, suivie de contenu Unicode UTF-8 (voir la :rfc:`la spécification correspondante <5424#section-6>`).

Reviewed-on: AFPy/python-docs-fr#118
This commit is contained in:
Julien Palard 2023-04-01 19:44:08 +00:00
parent 67f8f6cd58
commit c68566b785
7 changed files with 68 additions and 17 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ venv/
.potodo/
locales/
.venv/
.envrc

38
.scripts/line-length.py Normal file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env python
"""Measure line length in given files, run as:
python line-length.py *.po
It does not count zero-width caracters from the Mn Unicode category
(Nonspacing Mark).
It returns 0 on success, 1 on failure.
"""
from unicodedata import category
import fileinput
import sys
SOFT_LIMIT = 80 # used for splitables lines (with spaces in them)
HARD_LIMIT = 88 # used for non-splitables lines (without spaces in them)
def clean(line):
return "".join(char for char in line if category(char) != "Mn").rstrip("\n")
return_code = 0
for line in fileinput.input(encoding="utf-8"):
line = clean(line)
limit = SOFT_LIMIT if line.count(" ") > 1 else HARD_LIMIT
if len(line) > limit:
print(
f"{fileinput.filename()}:{fileinput.filelineno()} line too long "
f"({len(line)} > {limit} characters)",
file=sys.stderr,
)
return_code = 1
sys.exit(return_code)

View File

@ -4,7 +4,10 @@ pipeline:
test:
image: python
commands:
- apt-get update
- apt-get install -y hunspell hunspell-fr-comprehensive
- python3 -m pip install -r requirements.txt
- sphinx-lint --enable all --disable line-too-long *.po */*.po
- pospell -p dict -l fr_FR *.po */*.po
- awk '{if (length(gensub(/శ్రీనివాస్/, ".", "g", $$0)) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $$0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}' *.po */*.po
- BRANCH="$(grep ^BRANCH Makefile | awk '{print $3}')"
- git fetch origin --no-tags +refs/heads/$BRANCH
- git branch $BRANCH origin/$BRANCH
- make verifs

View File

@ -85,7 +85,7 @@ else
endif
.PHONY: all
all: ensure_prerequisites
all: ensure_build_prerequisites
git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT) || (git -C venv/cpython fetch && git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT))
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
$(CP_CMD) -u --parents *.po */*.po locales/$(LANGUAGE)/LC_MESSAGES/
@ -108,13 +108,22 @@ venv/cpython/.git/HEAD:
git clone https://github.com/python/cpython venv/cpython
.PHONY: ensure_prerequisites
ensure_prerequisites: venv/cpython/.git/HEAD
.PHONY: ensure_test_prerequisites
ensure_test_prerequisites:
@if ! (pospell --help >/dev/null 2>&1 && potodo --help >/dev/null 2>&1); then \
echo "You're missing dependencies please install:"; \
echo ""; \
echo " python -m pip install -r requirements.txt"; \
exit 1; \
fi
.PHONY: ensure_build_prerequisites
ensure_build_prerequisites: venv/cpython/.git/HEAD
@if ! (blurb help >/dev/null 2>&1 && sphinx-build --version >/dev/null 2>&1); then \
git -C venv/cpython/ checkout $(BRANCH); \
echo "You're missing dependencies please install:"; \
echo ""; \
echo " python -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt"; \
echo " python -m pip install -r venv/cpython/Doc/requirements.txt"; \
exit 1; \
fi
@ -123,11 +132,11 @@ htmlview: MODE=htmlview
htmlview: all
.PHONY: todo
todo: ensure_prerequisites
todo: ensure_test_prerequisites
potodo --api-url 'https://git.afpy.org/api/v1/repos/AFPy/python-docs-fr/issues?state=open&type=issues' --exclude venv .venv $(EXCLUDED)
.PHONY: wrap
wrap: ensure_prerequisites
wrap: ensure_test_prerequisites
@echo "Re wrapping modified files"
powrap -m
@ -136,15 +145,15 @@ SRCS = $(shell git diff --name-only $(BRANCH) | grep '.po$$')
DESTS = $(addprefix $(POSPELL_TMP_DIR)/,$(addsuffix .out,$(SRCS)))
.PHONY: spell
spell: ensure_prerequisites $(DESTS)
spell: ensure_test_prerequisites $(DESTS)
.PHONY: line-length
line-length:
@echo "Searching for long lines..."
@awk '{if (length(gensub(/శ్రీనివాస్/, ".", "g", $$0)) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $$0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}' *.po */*.po
@python .scripts/line-length.py *.po */*.po
.PHONY: sphinx-lint
sphinx-lint:
sphinx-lint: ensure_test_prerequisites
@echo "Checking all files using sphinx-lint..."
@sphinx-lint --enable all --disable line-too-long *.po */*.po
@ -154,7 +163,7 @@ $(POSPELL_TMP_DIR)/%.po.out: %.po dict
pospell -p dict -l fr_FR $< && touch $@
.PHONY: fuzzy
fuzzy: ensure_prerequisites
fuzzy: ensure_test_prerequisites
potodo --only-fuzzy --api-url 'https://git.afpy.org/api/v1/repos/AFPy/python-docs-fr/issues?state=open&type=issues' --exclude venv .venv $(EXCLUDED)
.PHONY: check-headers

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-15 22:33+0100\n"
"PO-Revision-Date: 2022-12-16 21:12+0100\n"
"PO-Revision-Date: 2023-03-28 11:09+0200\n"
"Last-Translator: Nabil Bendafi <nabil@bendafi.fr>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
@ -1762,7 +1762,7 @@ msgid ""
"substitutions."
msgstr ""
"Les renvois tels que celui-ci ne sont pas très utiles pour effectuer une "
"simple recherche dans une chaîne —­ il n'y a que peu de formats de textes qui "
"simple recherche dans une chaîne — il n'y a que peu de formats de textes qui "
"répètent des données ainsi — mais vous verrez bientôt qu'ils sont *très* "
"utiles pour effectuer des substitutions dans les chaînes."

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-15 22:33+0100\n"
"PO-Revision-Date: 2023-02-09 12:25+0100\n"
"PO-Revision-Date: 2023-03-28 11:15+0200\n"
"Last-Translator: Mathieu Dupuy <deronnax@gmail.com>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
@ -2372,7 +2372,7 @@ msgstr ""
"répertoire, et le chemin sur lequel opérer devrait être relatif. Le chemin "
"est donc relatif à ce répertoire. Si le chemin est absolu, *dir_fd* est "
"ignoré (pour les systèmes POSIX, Python appelle la version avec un suffixe "
"``at`` et potentiellement préfixée avec ``f`` ­— par exemple ``faccessat`` au "
"``at`` et potentiellement préfixée avec ``f`` — par exemple ``faccessat`` au "
"lieu de ``access``)."
#: library/os.rst:1733