Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
26 changes: 26 additions & 0 deletions .devcontainer/script/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/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

# Install and configure pre-commit
python3 -m pip install pre-commit
pre-commit install
61 changes: 61 additions & 0 deletions .devcontainer/vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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": []
}
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ venv/
.potodo/
locales/
.venv/
.vscode/
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/AFPy/powrap
rev: v1.0.0
hooks:
- id: powrap
- repo: https://github.com/AFPy/pospell
rev: v1.1
hooks:
- id: pospell
args: [--language, fr, -p, dict]
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:"; \
Expand Down