From 81fed519a525686edf31cbd2856d91f3854d6c3a Mon Sep 17 00:00:00 2001 From: Ezlo Picori Date: Tue, 8 Feb 2022 20:33:14 +0100 Subject: [PATCH 1/5] =?UTF-8?q?NEW=20D=C3=A9finition=20d'un=20devcontainer?= =?UTF-8?q?=20pour=20aider=20la=20traduction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .devcontainer/Dockerfile.dev | 19 ++++++++++ .devcontainer/devcontainer.json | 28 +++++++++++++++ .devcontainer/script/setup | 22 ++++++++++++ .devcontainer/vscode/tasks.json | 61 +++++++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 4 ++- 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile.dev create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/script/setup create mode 100644 .devcontainer/vscode/tasks.json diff --git a/.devcontainer/Dockerfile.dev b/.devcontainer/Dockerfile.dev new file mode 100644 index 000000000..3537c3e86 --- /dev/null +++ b/.devcontainer/Dockerfile.dev @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10 + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN \ + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + # Additional library needed by some tests and accordingly by VScode Tests Discovery + gettext \ + git \ + hunspell \ + hunspell-fr-comprehensive \ + make \ + python3-pip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV SHELL /bin/bash \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..dafca84c5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "Environnement de traduction française de la Documentation Python", + "context": "..", + "dockerFile": "./Dockerfile.dev", + "postCreateCommand": ".devcontainer/script/setup", + "containerEnv": { + "DEVCONTAINER": "1" + }, + "forwardPorts": [8000], + "runArgs": [ + "-e", + "GIT_EDITOR=code --wait" + ], + "extensions": [ + "mrorz.language-gettext" + ], + "settings": { + "editor.rulers": [ + 79 + ], + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh" + } +} \ No newline at end of file diff --git a/.devcontainer/script/setup b/.devcontainer/script/setup new file mode 100755 index 000000000..39302e0f8 --- /dev/null +++ b/.devcontainer/script/setup @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Setups the repository + +# Stop on errors +set -e + +# Go to base directory +cd "$(git rev-parse --show-toplevel)" + +# Install venv +make venv/cpython/.git/HEAD + +# Install python deps +python3 -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt +make ensure_prerequisites + +# Generate .vscode configuration +if [ ! -d ".vscode" ]; then + mkdir .vscode + cp .devcontainer/vscode/*.json .vscode/ +fi diff --git a/.devcontainer/vscode/tasks.json b/.devcontainer/vscode/tasks.json new file mode 100644 index 000000000..df5ab0672 --- /dev/null +++ b/.devcontainer/vscode/tasks.json @@ -0,0 +1,61 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "verifs: vérifications de longueur de ligne et d'orthographe", + "type": "shell", + "command": "make verifs", + "group": "lint", + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, + { + "label": "make: génère la documentation", + "type": "shell", + "command": "make", + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, + { + "label": "serve: publie la documentation localement", + "type": "shell", + "command": "make serve", + "group": "build", + "dependsOn": ["make: génère la documentation"], + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, + { + "label": "wrap: corrige la longueur des lignes", + "type": "shell", + "command": "make wrap", + "group": "lint", + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, + { + "label": "todo: liste les traductions à réaliser", + "type": "shell", + "command": "make todo", + "group": "lint", + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6d4d663da..9f3a4f45e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ venv/ .potodo/ locales/ .venv/ +.vscode/ \ No newline at end of file diff --git a/Makefile b/Makefile index e581c68b3..614043840 100644 --- a/Makefile +++ b/Makefile @@ -84,9 +84,11 @@ all: ensure_prerequisites venv/cpython/.git/HEAD: git clone https://github.com/python/cpython venv/cpython +.git/refs/heads/$(BRANCH): + git fetch $(shell git remote | head -n 1) $(BRANCH):$(BRANCH) .PHONY: ensure_prerequisites -ensure_prerequisites: venv/cpython/.git/HEAD +ensure_prerequisites: venv/cpython/.git/HEAD .git/refs/heads/$(BRANCH) @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:"; \ From b4682a806003a986e7f50a4a96a0eb879b5c6eac Mon Sep 17 00:00:00 2001 From: Ezlo Picori Date: Wed, 9 Feb 2022 19:40:49 +0000 Subject: [PATCH 2/5] NEW Add pospell and powrap as pre-commit hooks --- .devcontainer/script/setup | 4 ++++ .pre-commit-config.yaml | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.devcontainer/script/setup b/.devcontainer/script/setup index 39302e0f8..ab08d736d 100755 --- a/.devcontainer/script/setup +++ b/.devcontainer/script/setup @@ -20,3 +20,7 @@ if [ ! -d ".vscode" ]; then mkdir .vscode cp .devcontainer/vscode/*.json .vscode/ fi + +# Install and configure pre-commit +python3 -m pip install pre-commit +pre-commit install diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..eccb4f72c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: +- repo: https://github.com/AFPy/powrap + rev: v1.0.0 + hooks: + - id: powrap +- repo: https://github.com/AFPy/pospell + rev: v1.0.13 + hooks: + - id: pospell From cc5fc73ea864f51de21ea0179f2d490ca6d8dc09 Mon Sep 17 00:00:00 2001 From: Ezlo Picori Date: Wed, 9 Feb 2022 23:06:00 +0000 Subject: [PATCH 3/5] =?UTF-8?q?[pospell]=20Ajout=20d'un=20dictionnaire=20p?= =?UTF-8?q?ersonnalis=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pospell.dic | 0 .pre-commit-config.yaml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .pospell.dic diff --git a/.pospell.dic b/.pospell.dic new file mode 100644 index 000000000..e69de29bb diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eccb4f72c..94e881295 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,7 @@ repos: hooks: - id: powrap - repo: https://github.com/AFPy/pospell - rev: v1.0.13 + rev: v1.1 hooks: - id: pospell + args: [--language, fr, -p, .pospell.dic ] \ No newline at end of file From 5ca51e659382e1af274a135659f3828ed5c8581d Mon Sep 17 00:00:00 2001 From: Ezlo Picori Date: Wed, 9 Feb 2022 23:25:50 +0000 Subject: [PATCH 4/5] =?UTF-8?q?D=C3=A9but=20de=20compl=C3=A9tion=20du=20di?= =?UTF-8?q?ctionnaire=20personnalis=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pospell.dic | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.pospell.dic b/.pospell.dic index e69de29bb..e51ddffb5 100644 --- a/.pospell.dic +++ b/.pospell.dic @@ -0,0 +1,14 @@ +Catucci/Bob +Hettinger/Bob +Guido/Bob +Kuchling/Bob +Serwy/Bob +concourance/concordance +hachable/cassable +intraligne/ligne +journaliseur/enregistreur +muabilité/mutabilité +muable/mutable +multiensemble/sous-ensemble +réentrant/entrant +world/build \ No newline at end of file From 4f86f43904258d6542e6d8d0ad8f595b0b2b9561 Mon Sep 17 00:00:00 2001 From: Ezlo Picori Date: Thu, 10 Feb 2022 11:50:30 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Utilisation=20du=20dictionnaire=20pospell?= =?UTF-8?q?=20pr=C3=A9-existant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pospell.dic | 14 -------------- .pre-commit-config.yaml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 .pospell.dic diff --git a/.pospell.dic b/.pospell.dic deleted file mode 100644 index e51ddffb5..000000000 --- a/.pospell.dic +++ /dev/null @@ -1,14 +0,0 @@ -Catucci/Bob -Hettinger/Bob -Guido/Bob -Kuchling/Bob -Serwy/Bob -concourance/concordance -hachable/cassable -intraligne/ligne -journaliseur/enregistreur -muabilité/mutabilité -muable/mutable -multiensemble/sous-ensemble -réentrant/entrant -world/build \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94e881295..cd155815d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,4 +7,4 @@ repos: rev: v1.1 hooks: - id: pospell - args: [--language, fr, -p, .pospell.dic ] \ No newline at end of file + args: [--language, fr, -p, dict] \ No newline at end of file