2222# .po files.
2323CPYTHON_CURRENT_COMMIT := d5feb2b1f12a15c1a9bac094a8f6f77d0cfcbdc2
2424
25- CPYTHON_PATH := ../cpython/
26-
2725LANGUAGE := fr
2826BRANCH := 3.10
2927
@@ -57,52 +55,41 @@ endif
5755
5856.PHONY : all
5957all : ensure_prerequisites
60- git -C $( CPYTHON_PATH ) checkout $(CPYTHON_CURRENT_COMMIT )
58+ git -C venv/cpython checkout $( CPYTHON_CURRENT_COMMIT ) || (git -C venv/cpython fetch && git -C venv/cpython checkout $( CPYTHON_CURRENT_COMMIT) )
6159 mkdir -p locales/$(LANGUAGE ) /LC_MESSAGES/
6260 $(CP_CMD ) -u --parents * .po * /* .po locales/$(LANGUAGE ) /LC_MESSAGES/
63- $(MAKE ) -C $( CPYTHON_PATH ) / Doc/ \
64- SPHINXOPTS=' -j$(JOBS) \
61+ $(MAKE ) -C venv/cpython/ Doc/ \
62+ SPHINXOPTS=' -j$(JOBS) \
6563 -D locale_dirs=$(abspath locales) \
6664 -D language=$(LANGUAGE ) \
67- -D gettext_compact=0 \
65+ -D gettext_compact=0 \
6866 -D latex_engine=xelatex \
6967 -D latex_elements.inputenc= \
7068 -D latex_elements.fontenc=' \
7169 $(MODE )
72- @echo " Build success, open file://$( abspath $( CPYTHON_PATH) ) /Doc/build/html/index.html or run 'make serve' to see them."
70+ @echo " Build success, open file://$( abspath venv/cpython/) /Doc/build/html/index.html or run 'make serve' to see them."
71+
72+
73+ # We clone cpython/ inside venv/ because venv/ is the only directory
74+ # excluded by cpython' Sphinx configuration.
75+ venv/cpython/.git/HEAD :
76+ git clone https://github.com/python/cpython venv/cpython
7377
7478
7579.PHONY : ensure_prerequisites
76- ensure_prerequisites :
77- @if [ -z $( CPYTHON_PATH) ]; then \
78- echo " Your CPYTHON_PATH is empty, please provide one." ; \
79- exit 1; \
80- fi
81- @if ! [ -d $( CPYTHON_PATH) ]; then \
82- echo " Building the translation requires a cpython clone." ; \
83- echo " Please provide the path to a clone using the CPYTHON_PATH variable." ; \
84- echo " (Currently CPYTHON_PATH is $( CPYTHON_PATH) ." ; \
85- echo " So you may want to run:" ; \
86- echo " " ; \
87- echo " git clone $( UPSTREAM) $( CPYTHON_PATH) " ; \
88- exit 1; \
89- fi
90- @if [ -n " $$ (git -C $( CPYTHON_PATH) status --porcelain)" ]; then \
91- echo " Your cpython clone at $( CPYTHON_PATH) is not clean." ; \
92- echo " In order to avoid breaking things, please clean it first." ; \
93- exit 1; \
94- fi
80+ ensure_prerequisites : venv/cpython/.git/HEAD
9581 @if ! (blurb help > /dev/null 2>&1 && sphinx-build --version > /dev/null 2>&1 ); then \
96- git -C $( CPYTHON_PATH ) checkout $(BRANCH ) ; \
97- echo " You're missing dependencies, please enable a venv and install:" ; \
82+ git -C venv/cpython/ checkout $(BRANCH ) ; \
83+ echo " You're missing dependencies please install:" ; \
9884 echo " " ; \
99- echo " python -m pip install -r requirements.txt -r $( CPYTHON_PATH ) /Doc/requirements.txt" ; \
85+ echo " python -m pip install -r requirements.txt -r venv/cpython /Doc/requirements.txt" ; \
10086 exit 1; \
10187 fi
10288
89+
10390.PHONY : serve
10491serve :
105- $(MAKE ) -C $( CPYTHON_PATH ) /Doc/ serve
92+ $(MAKE ) -C venv/cpython /Doc/ serve
10693
10794.PHONY : todo
10895todo : ensure_prerequisites
@@ -135,13 +122,13 @@ verifs: wrap spell
135122.PHONY : merge
136123merge : ensure_prerequisites
137124 @echo " Merge from $( UPSTREAM) "
138- git -C $( CPYTHON_PATH ) checkout $(BRANCH )
139- git -C $( CPYTHON_PATH ) pull --ff-only
140- (cd $( CPYTHON_PATH ) /Doc; sphinx-build -Q -b gettext -D gettext_compact=0 . ../pot)
141- find $( CPYTHON_PATH ) /pot/ -name ' *.pot' | \
125+ git -C venv/cpython/ checkout $(BRANCH )
126+ git -C venv/cpython/ pull --ff-only
127+ (cd venv/cpython /Doc; sphinx-build -Q -b gettext -D gettext_compact=0 . ../pot)
128+ find venv/cpython /pot/ -name ' *.pot' | \
142129 while read -r POT; \
143130 do \
144- PO=" ./$$ (echo " $$ POT" | sed " s#$( CPYTHON_PATH ) /pot/# #; s#\.pot\$$#.po#")"; \
131+ PO=" ./$$ (echo " $$ POT" | sed " s#venv/cpython /pot/# #; s#\.pot\$$#.po#")"; \
145132 mkdir -p " $$ (dirname " $$ PO" )" ; \
146133 if [ -f " $$ PO" ]; \
147134 then \
@@ -150,10 +137,10 @@ merge: ensure_prerequisites
150137 msgcat -o " $$ PO" " $$ POT" ; \
151138 fi \
152139 done
153- rm -fr $( CPYTHON_PATH ) /pot/
140+ rm -fr venv/cpython /pot/
154141 sed -i ' s|^#: .*Doc/|#: |' * .po * /* .po
155142 powrap -m
156- @printf " \n%s %s\n" " Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C $( CPYTHON_PATH ) rev-parse HEAD)
143+ @printf " \n%s %s\n" " Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C venv/cpython/ rev-parse HEAD)
157144 @printf ' To add, you can use:\n git status -s | grep "^ M .*\.po" | cut -d" " -f3 | while read -r file; do if [ $$(git diff "$$file" | wc -l) -gt 13 ]; then git add "$$file"; fi ; done\n'
158145
159146.PHONY : clean
0 commit comments