2017-10-13 20:39:17 +00:00
|
|
|
# Makefile for French Python Documentation
|
|
|
|
#
|
|
|
|
# Here is what you can do:
|
|
|
|
#
|
2021-01-27 18:23:53 +00:00
|
|
|
# - make # Automatically build an HTML local version
|
2021-09-16 10:33:51 +00:00
|
|
|
# - make todo # To list remaining tasks and show current progression
|
2019-12-10 10:52:16 +00:00
|
|
|
# - make verifs # To check for correctness: wrapping, spelling
|
2021-11-04 17:14:17 +00:00
|
|
|
# - make wrap # To rewrap modified files
|
2019-12-10 10:52:16 +00:00
|
|
|
# - make spell # To check for spelling
|
2021-10-20 13:32:30 +00:00
|
|
|
# - make clean # To remove build artifacts
|
2017-10-13 20:39:17 +00:00
|
|
|
# - make fuzzy # To find fuzzy strings
|
|
|
|
#
|
|
|
|
# Modes are: autobuild-stable, autobuild-dev, and autobuild-html,
|
|
|
|
# documented in gen/src/3.6/Doc/Makefile as we're only delegating the
|
|
|
|
# real work to the Python Doc Makefile.
|
|
|
|
|
2019-12-10 10:52:16 +00:00
|
|
|
# Configuration
|
|
|
|
|
|
|
|
# The CPYTHON_CURRENT_COMMIT is the commit, in the cpython repository,
|
|
|
|
# from which we generated our po files. We use it here so when we
|
|
|
|
# test build, we're building with the .rst files that generated our
|
|
|
|
# .po files.
|
2023-04-14 11:20:40 +00:00
|
|
|
CPYTHON_CURRENT_COMMIT := 2e0ead5f22bb7699d70f1dfb6d1eadff124f2688
|
2017-10-13 20:39:17 +00:00
|
|
|
LANGUAGE := fr
|
2022-03-23 17:40:12 +00:00
|
|
|
BRANCH := 3.11
|
2019-12-10 10:52:16 +00:00
|
|
|
|
2021-10-21 12:53:28 +00:00
|
|
|
EXCLUDED := \
|
2021-11-27 16:48:35 +00:00
|
|
|
whatsnew/2.?.po \
|
|
|
|
whatsnew/3.[0-8].po \
|
2021-10-21 12:53:28 +00:00
|
|
|
c-api/ \
|
|
|
|
distutils/ \
|
|
|
|
install/ \
|
|
|
|
library/2to3.po \
|
|
|
|
library/distutils.po \
|
|
|
|
library/imp.po \
|
2021-11-07 16:24:35 +00:00
|
|
|
library/tkinter.tix.po \
|
2022-04-05 19:48:31 +00:00
|
|
|
library/test.po \
|
|
|
|
library/aifc.po \
|
|
|
|
library/asynchat.po \
|
|
|
|
library/asyncore.po \
|
|
|
|
library/audioop.po \
|
|
|
|
library/cgi.po \
|
|
|
|
library/cgitb.po \
|
|
|
|
library/chunk.po \
|
|
|
|
library/crypt.po \
|
|
|
|
library/imghdr.po \
|
|
|
|
library/msilib.po \
|
|
|
|
library/nntplib.po \
|
|
|
|
library/nis.po \
|
|
|
|
library/ossaudiodev.po \
|
|
|
|
library/pipes.po \
|
|
|
|
library/smtpd.po \
|
|
|
|
library/sndhdr.po \
|
|
|
|
library/spwd.po \
|
|
|
|
library/sunau.po \
|
|
|
|
library/telnetlib.po \
|
|
|
|
library/uu.po \
|
|
|
|
library/xdrlib.po
|
2020-06-10 18:16:22 +00:00
|
|
|
|
2019-12-10 10:52:16 +00:00
|
|
|
# Internal variables
|
|
|
|
|
|
|
|
UPSTREAM := https://github.com/python/cpython
|
2021-01-27 18:23:53 +00:00
|
|
|
|
2017-10-13 20:39:17 +00:00
|
|
|
PYTHON := $(shell which python3)
|
2018-11-14 20:47:36 +00:00
|
|
|
MODE := html
|
2019-12-10 12:57:17 +00:00
|
|
|
POSPELL_TMP_DIR := .pospell/
|
2019-12-10 10:52:16 +00:00
|
|
|
JOBS := auto
|
2023-02-04 07:26:16 +00:00
|
|
|
SPHINXERRORHANDLING = -W
|
2017-10-13 20:39:17 +00:00
|
|
|
|
2020-05-30 09:36:13 +00:00
|
|
|
# Detect OS
|
|
|
|
|
|
|
|
ifeq '$(findstring ;,$(PATH))' ';'
|
|
|
|
detected_OS := Windows
|
|
|
|
else
|
|
|
|
detected_OS := $(shell uname 2>/dev/null || echo Unknown)
|
|
|
|
detected_OS := $(patsubst CYGWIN%,Cygwin,$(detected_OS))
|
|
|
|
detected_OS := $(patsubst MSYS%,MSYS,$(detected_OS))
|
|
|
|
detected_OS := $(patsubst MINGW%,MSYS,$(detected_OS))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(detected_OS),Darwin) # Mac OS X
|
|
|
|
CP_CMD := gcp # accessible with `brew install coreutils` or `brew upgrade coreutils`
|
|
|
|
else
|
|
|
|
CP_CMD := cp
|
|
|
|
endif
|
|
|
|
|
2017-10-13 20:39:17 +00:00
|
|
|
.PHONY: all
|
2023-04-01 19:44:08 +00:00
|
|
|
all: ensure_build_prerequisites
|
2021-09-25 14:09:15 +00:00
|
|
|
git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT) || (git -C venv/cpython fetch && git -C venv/cpython checkout $(CPYTHON_CURRENT_COMMIT))
|
2021-01-27 18:23:53 +00:00
|
|
|
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
|
|
|
|
$(CP_CMD) -u --parents *.po */*.po locales/$(LANGUAGE)/LC_MESSAGES/
|
2021-09-25 14:09:15 +00:00
|
|
|
$(MAKE) -C venv/cpython/Doc/ \
|
2023-02-04 07:26:16 +00:00
|
|
|
JOBS='$(JOBS)' \
|
|
|
|
SPHINXOPTS='-D locale_dirs=$(abspath locales) \
|
2021-01-27 18:23:53 +00:00
|
|
|
-D language=$(LANGUAGE) \
|
2021-09-25 14:09:15 +00:00
|
|
|
-D gettext_compact=0 \
|
2021-01-27 18:23:53 +00:00
|
|
|
-D latex_engine=xelatex \
|
|
|
|
-D latex_elements.inputenc= \
|
|
|
|
-D latex_elements.fontenc=' \
|
2023-02-04 07:26:16 +00:00
|
|
|
SPHINXERRORHANDLING=$(SPHINXERRORHANDLING) \
|
2021-01-27 18:23:53 +00:00
|
|
|
$(MODE)
|
2022-11-13 14:29:30 +00:00
|
|
|
@echo "Build success, open file://$(abspath venv/cpython/)/Doc/build/html/index.html or run 'make htmlview' to see them."
|
2021-09-25 14:09:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
# We clone cpython/ inside venv/ because venv/ is the only directory
|
|
|
|
# excluded by cpython' Sphinx configuration.
|
|
|
|
venv/cpython/.git/HEAD:
|
|
|
|
git clone https://github.com/python/cpython venv/cpython
|
2021-01-27 18:23:53 +00:00
|
|
|
|
|
|
|
|
2023-04-01 19:44:08 +00:00
|
|
|
.PHONY: ensure_test_prerequisites
|
|
|
|
ensure_test_prerequisites:
|
2023-05-23 18:47:00 +00:00
|
|
|
@if ! (hunspell -v >/dev/null 2>&1); then \
|
|
|
|
echo "You're missing dependencies please install: hunspell and the fr-toutesvariantes dictionary."; \
|
|
|
|
echo "The dictionary is available here http://grammalecte.net:8080/dir?ci=tip&name=gc_lang/fr/oxt/Dictionnaires/dictionaries"; \
|
|
|
|
echo "and also included in the hunspell-fr-comprehensive Debian package."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2023-04-01 19:44:08 +00:00
|
|
|
@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
|
2021-01-27 18:23:53 +00:00
|
|
|
@if ! (blurb help >/dev/null 2>&1 && sphinx-build --version >/dev/null 2>&1); then \
|
2021-09-25 14:09:15 +00:00
|
|
|
git -C venv/cpython/ checkout $(BRANCH); \
|
|
|
|
echo "You're missing dependencies please install:"; \
|
2021-01-27 18:23:53 +00:00
|
|
|
echo ""; \
|
2023-04-01 19:44:08 +00:00
|
|
|
echo " python -m pip install -r venv/cpython/Doc/requirements.txt"; \
|
2021-01-27 18:23:53 +00:00
|
|
|
exit 1; \
|
2019-12-12 08:30:09 +00:00
|
|
|
fi
|
2019-11-15 14:09:14 +00:00
|
|
|
|
2022-11-13 14:29:30 +00:00
|
|
|
.PHONY: htmlview
|
|
|
|
htmlview: MODE=htmlview
|
|
|
|
htmlview: all
|
2018-08-01 12:57:26 +00:00
|
|
|
|
2017-10-13 20:39:17 +00:00
|
|
|
.PHONY: todo
|
2023-04-01 19:44:08 +00:00
|
|
|
todo: ensure_test_prerequisites
|
2023-03-19 09:01:48 +00:00
|
|
|
potodo --api-url 'https://git.afpy.org/api/v1/repos/AFPy/python-docs-fr/issues?state=open&type=issues' --exclude venv .venv $(EXCLUDED)
|
2017-10-13 20:39:17 +00:00
|
|
|
|
2019-12-04 21:08:12 +00:00
|
|
|
.PHONY: wrap
|
2023-04-01 19:44:08 +00:00
|
|
|
wrap: ensure_test_prerequisites
|
2021-11-04 17:14:17 +00:00
|
|
|
@echo "Re wrapping modified files"
|
|
|
|
powrap -m
|
2019-03-30 08:30:23 +00:00
|
|
|
|
2019-12-10 12:57:17 +00:00
|
|
|
SRCS = $(shell git diff --name-only $(BRANCH) | grep '.po$$')
|
|
|
|
# foo/bar.po => $(POSPELL_TMP_DIR)/foo/bar.po.out
|
|
|
|
DESTS = $(addprefix $(POSPELL_TMP_DIR)/,$(addsuffix .out,$(SRCS)))
|
|
|
|
|
2019-12-04 21:08:12 +00:00
|
|
|
.PHONY: spell
|
2023-04-01 19:44:08 +00:00
|
|
|
spell: ensure_test_prerequisites $(DESTS)
|
2019-12-10 12:57:17 +00:00
|
|
|
|
2022-11-21 21:14:49 +00:00
|
|
|
.PHONY: line-length
|
|
|
|
line-length:
|
2023-04-14 11:16:50 +00:00
|
|
|
@echo Checking line length...
|
2023-04-14 12:51:09 +00:00
|
|
|
@if [ -n "$(SRCS)" ]; then python .scripts/line-length.py $(SRCS); fi
|
2022-11-21 21:14:49 +00:00
|
|
|
|
|
|
|
.PHONY: sphinx-lint
|
2023-04-01 19:44:08 +00:00
|
|
|
sphinx-lint: ensure_test_prerequisites
|
2023-04-14 11:16:50 +00:00
|
|
|
@echo Checking reStructuredText syntax...
|
2023-04-14 12:51:09 +00:00
|
|
|
@if [ -n "$(SRCS)" ]; then sphinx-lint --enable all --disable line-too-long $(SRCS); fi
|
2022-11-21 21:14:49 +00:00
|
|
|
|
2019-12-10 12:57:17 +00:00
|
|
|
$(POSPELL_TMP_DIR)/%.po.out: %.po dict
|
2021-01-27 18:23:53 +00:00
|
|
|
@echo "Pospell checking $<..."
|
2022-11-21 21:14:49 +00:00
|
|
|
@mkdir -p $(@D)
|
2021-01-27 18:23:53 +00:00
|
|
|
pospell -p dict -l fr_FR $< && touch $@
|
2019-03-30 08:30:23 +00:00
|
|
|
|
2019-12-10 10:52:16 +00:00
|
|
|
.PHONY: fuzzy
|
2023-04-01 19:44:08 +00:00
|
|
|
fuzzy: ensure_test_prerequisites
|
2023-03-19 09:01:48 +00:00
|
|
|
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)
|
2019-12-10 10:52:16 +00:00
|
|
|
|
2023-02-07 22:52:58 +00:00
|
|
|
.PHONY: check-headers
|
|
|
|
check-headers:
|
2023-04-14 11:16:50 +00:00
|
|
|
@echo Checking po headers...
|
2023-04-14 12:51:09 +00:00
|
|
|
@sh .scripts/check-headers.sh $(SRCS)
|
2023-02-07 22:52:58 +00:00
|
|
|
|
2023-05-31 09:55:00 +00:00
|
|
|
# .PHONY: check-colons
|
|
|
|
# check-colons:
|
|
|
|
# @echo Checking colons...
|
|
|
|
# @python .scripts/check-colon.py --check $(SRCS)
|
2023-04-14 11:16:50 +00:00
|
|
|
|
2019-12-10 10:52:16 +00:00
|
|
|
.PHONY: verifs
|
2023-05-31 09:55:00 +00:00
|
|
|
verifs: spell line-length check-headers sphinx-lint
|
2019-12-10 10:52:16 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2021-01-27 18:23:53 +00:00
|
|
|
@echo "Cleaning *.mo and $(POSPELL_TMP_DIR)"
|
2023-02-04 07:26:16 +00:00
|
|
|
rm -fr $(POSPELL_TMP_DIR) locales/$(LANGUAGE)/LC_MESSAGES/
|
2019-12-10 10:52:16 +00:00
|
|
|
find -name '*.mo' -delete
|
2021-10-20 13:32:30 +00:00
|
|
|
@echo "Cleaning build directory"
|
|
|
|
$(MAKE) -C venv/cpython/Doc/ clean
|