Skip to content

Commit e2bbabd

Browse files
committed
Use our own cpython clone.
1 parent 17d5f9c commit e2bbabd

1 file changed

Lines changed: 27 additions & 36 deletions

File tree

Makefile

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
# .po files.
2323
CPYTHON_CURRENT_COMMIT := d5feb2b1f12a15c1a9bac094a8f6f77d0cfcbdc2
2424

25-
CPYTHON_PATH := ../cpython/
26-
2725
LANGUAGE := fr
2826
BRANCH := 3.10
2927

@@ -57,52 +55,45 @@ endif
5755

5856
.PHONY: all
5957
all: ensure_prerequisites
60-
git -C $(CPYTHON_PATH) checkout $(CPYTHON_CURRENT_COMMIT)
6158
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
6259
$(CP_CMD) -u --parents *.po */*.po locales/$(LANGUAGE)/LC_MESSAGES/
63-
$(MAKE) -C $(CPYTHON_PATH)/Doc/ \
64-
SPHINXOPTS='-j$(JOBS) \
60+
$(MAKE) -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/Doc/ \
61+
SPHINXOPTS='-j$(JOBS) \
6562
-D locale_dirs=$(abspath locales) \
6663
-D language=$(LANGUAGE) \
67-
-D gettext_compact=0 \
64+
-D gettext_compact=0 \
6865
-D latex_engine=xelatex \
6966
-D latex_elements.inputenc= \
7067
-D latex_elements.fontenc=' \
7168
$(MODE)
72-
@echo "Build success, open file://$(abspath $(CPYTHON_PATH))/Doc/build/html/index.html or run 'make serve' to see them."
69+
@echo "Build success, open file://$(abspath venv/cpython/$(CPYTHON_CURRENT_COMMIT)/)/Doc/build/html/index.html or run 'make serve' to see them."
70+
71+
72+
venv/cpython/$(CPYTHON_CURRENT_COMMIT)/.git/HEAD:
73+
rm -fr venv/cpython/ # Remove old, deprecated, clones
74+
mkdir -p venv/cpython/$(CPYTHON_CURRENT_COMMIT)/
75+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ init
76+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ remote add origin https://github.com/python/cpython
77+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ fetch origin $(CPYTHON_CURRENT_COMMIT)
78+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ checkout FETCH_HEAD
7379

7480

81+
# We clone cpython/ inside venv/ because venv/ is the only directory
82+
# excluded by cpython' Sphinx configuration.
7583
.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
84+
ensure_prerequisites: venv/cpython/$(CPYTHON_CURRENT_COMMIT)/.git/HEAD
9585
@if ! (blurb help >/dev/null 2>&1 && sphinx-build --version >/dev/null 2>&1); then \
96-
git -C $(CPYTHON_PATH) checkout $(BRANCH); \
86+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ checkout $(BRANCH); \
9787
echo "You're missing dependencies, please enable a venv and install:"; \
9888
echo ""; \
99-
echo " python -m pip install -r requirements.txt -r $(CPYTHON_PATH)/Doc/requirements.txt"; \
89+
echo " python -m pip install -r requirements.txt -r venv/cpython/$(CPYTHON_CURRENT_COMMIT)/Doc/requirements.txt"; \
10090
exit 1; \
10191
fi
10292

93+
10394
.PHONY: serve
10495
serve:
105-
$(MAKE) -C $(CPYTHON_PATH)/Doc/ serve
96+
$(MAKE) -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/Doc/ serve
10697

10798
.PHONY: todo
10899
todo: ensure_prerequisites
@@ -135,13 +126,13 @@ verifs: wrap spell
135126
.PHONY: merge
136127
merge: ensure_prerequisites
137128
@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' |\
129+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ checkout $(BRANCH)
130+
git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ pull --ff-only
131+
(cd venv/cpython/$(CPYTHON_CURRENT_COMMIT)/Doc; sphinx-build -Q -b gettext -D gettext_compact=0 . ../pot)
132+
find venv/cpython/$(CPYTHON_CURRENT_COMMIT)/pot/ -name '*.pot' |\
142133
while read -r POT; \
143134
do \
144-
PO="./$$(echo "$$POT" | sed "s#$(CPYTHON_PATH)/pot/##; s#\.pot\$$#.po#")"; \
135+
PO="./$$(echo "$$POT" | sed "s#venv/cpython/$(CPYTHON_CURRENT_COMMIT)/pot/##; s#\.pot\$$#.po#")"; \
145136
mkdir -p "$$(dirname "$$PO")"; \
146137
if [ -f "$$PO" ]; \
147138
then \
@@ -150,10 +141,10 @@ merge: ensure_prerequisites
150141
msgcat -o "$$PO" "$$POT"; \
151142
fi \
152143
done
153-
rm -fr $(CPYTHON_PATH)/pot/
144+
rm -fr venv/cpython/$(CPYTHON_CURRENT_COMMIT)/pot/
154145
sed -i 's|^#: .*Doc/|#: |' *.po */*.po
155146
powrap -m
156-
@printf "\n%s %s\n" "Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C $(CPYTHON_PATH) rev-parse HEAD)
147+
@printf "\n%s %s\n" "Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C venv/cpython/$(CPYTHON_CURRENT_COMMIT)/ rev-parse HEAD)
157148
@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'
158149

159150
.PHONY: clean

0 commit comments

Comments
 (0)