1
- # Makefile for tr Python Documentation
1
+ # Makefile for Turkish Python Documentation
2
2
#
3
3
# Here is what you can do:
4
4
#
5
5
# - make # Automatically build an HTML local version
6
- # - make todo # To list remaining tasks
6
+ # - make todo # To list remaining tasks and show current progression
7
7
# - make verifs # To check for correctness: wrapping, spelling
8
- # - make wrap # To check for wrapping
8
+ # - make wrap # To rewrap modified files
9
9
# - make spell # To check for spelling
10
- # - make merge # To merge pot from upstream
10
+ # - make clean # To remove build artifacts
11
11
# - make fuzzy # To find fuzzy strings
12
- # - make progress # To compute current progression
13
12
#
14
13
# Modes are: autobuild-stable, autobuild-dev, and autobuild-html,
15
14
# documented in gen/src/3.6/Doc/Makefile as we're only delegating the
21
20
# from which we generated our po files. We use it here so when we
22
21
# test build, we're building with the .rst files that generated our
23
22
# .po files.
24
- CPYTHON_CURRENT_COMMIT := b027dd78bbdb66f2995bb898af304e66e5508bf6
25
-
26
- CPYTHON_PATH := ../cpython/
27
-
23
+ CPYTHON_CURRENT_COMMIT := e699e5c20fc495952905597edfa82de0c1848f8c
28
24
LANGUAGE := tr
29
25
BRANCH := 3.10
30
26
31
- EXCLUDED := whatsnew/ c-api/
27
+ EXCLUDED := \
28
+ whatsnew/2.?.po \
29
+ whatsnew/3.[0-8].po \
30
+ c-api/ \
31
+ distutils/ \
32
+ install/ \
33
+ library/2to3.po \
34
+ library/distutils.po \
35
+ library/imp.po \
36
+ library/tkinter.tix.po \
37
+ library/test.po \
38
+ library/aifc.po \
39
+ library/asynchat.po \
40
+ library/asyncore.po \
41
+ library/audioop.po \
42
+ library/cgi.po \
43
+ library/cgitb.po \
44
+ library/chunk.po \
45
+ library/crypt.po \
46
+ library/imghdr.po \
47
+ library/msilib.po \
48
+ library/nntplib.po \
49
+ library/nis.po \
50
+ library/ossaudiodev.po \
51
+ library/pipes.po \
52
+ library/smtpd.po \
53
+ library/sndhdr.po \
54
+ library/spwd.po \
55
+ library/sunau.po \
56
+ library/telnetlib.po \
57
+ library/uu.po \
58
+ library/xdrlib.po
32
59
33
60
# Internal variables
34
61
@@ -38,6 +65,7 @@ PYTHON := $(shell which python3)
38
65
MODE := html
39
66
POSPELL_TMP_DIR := .pospell/
40
67
JOBS := auto
68
+ SERVE_PORT :=
41
69
42
70
# Detect OS
43
71
@@ -58,89 +86,54 @@ endif
58
86
59
87
.PHONY : all
60
88
all : ensure_prerequisites
61
- git -C $( CPYTHON_PATH ) checkout $(CPYTHON_CURRENT_COMMIT )
89
+ git -C venv/cpython checkout $( CPYTHON_CURRENT_COMMIT ) || (git -C venv/cpython fetch && git -C venv/cpython checkout $( CPYTHON_CURRENT_COMMIT) )
62
90
mkdir -p locales/$(LANGUAGE ) /LC_MESSAGES/
63
91
$(CP_CMD ) -u --parents * .po * /* .po locales/$(LANGUAGE ) /LC_MESSAGES/
64
- $(MAKE ) -C $( CPYTHON_PATH ) / Doc/ \
65
- SPHINXOPTS=' -qW - j$(JOBS) \
92
+ $(MAKE ) -C venv/cpython/ Doc/ \
93
+ SPHINXOPTS=' -j$(JOBS) \
66
94
-D locale_dirs=$(abspath locales) \
67
95
-D language=$(LANGUAGE ) \
68
- -D gettext_compact=0 \
96
+ -D gettext_compact=0 \
69
97
-D latex_engine=xelatex \
70
98
-D latex_elements.inputenc= \
71
99
-D latex_elements.fontenc=' \
72
100
$(MODE )
73
- git -C $(CPYTHON_PATH ) checkout -
74
- @echo " Build success, open file://$( abspath $( CPYTHON_PATH) ) /Doc/build/html/index.html or run 'make serve' to see them."
101
+ @echo " Build success, open file://$( abspath venv/cpython/) /Doc/build/html/index.html or run 'make serve' to see them."
102
+
103
+
104
+ # We clone cpython/ inside venv/ because venv/ is the only directory
105
+ # excluded by cpython' Sphinx configuration.
106
+ venv/cpython/.git/HEAD :
107
+ git clone https://github.com/python/cpython venv/cpython
75
108
76
109
77
110
.PHONY : ensure_prerequisites
78
- ensure_prerequisites :
79
- @if [ -z $( CPYTHON_PATH) ]; then \
80
- echo " Your CPYTHON_PATH is empty, please provide one." ; \
81
- exit 1; \
82
- fi
83
- @if ! [ -d $( CPYTHON_PATH) ]; then \
84
- echo " Building the translation requires a cpython clone." ; \
85
- echo " Please provide the path to a clone using the CPYTHON_PATH variable." ; \
86
- echo " (Currently CPYTHON_PATH is $( CPYTHON_PATH) ." ; \
87
- echo " So you may want to run:" ; \
88
- echo " " ; \
89
- echo " git clone $( UPSTREAM) $( CPYTHON_PATH) " ; \
90
- exit 1; \
91
- fi
92
- @if [ -n " $$ (git -C $( CPYTHON_PATH) status --porcelain)" ]; then \
93
- echo " Your cpython clone at $( CPYTHON_PATH) is not clean." ; \
94
- echo " In order to avoid breaking things, please clean it first." ; \
95
- exit 1; \
96
- fi
111
+ ensure_prerequisites : venv/cpython/.git/HEAD
97
112
@if ! (blurb help > /dev/null 2>&1 && sphinx-build --version > /dev/null 2>&1 ); then \
98
- git -C $( CPYTHON_PATH ) checkout $(BRANCH ) ; \
99
- echo " You're missing dependencies, please enable a venv and install:" ; \
113
+ git -C venv/cpython/ checkout $(BRANCH ) ; \
114
+ echo " You're missing dependencies please install:" ; \
100
115
echo " " ; \
101
- echo " python -m pip install -r requirements.txt -r $( CPYTHON_PATH ) /Doc/requirements.txt" ; \
116
+ echo " python -m pip install -r requirements.txt -r venv/cpython /Doc/requirements.txt" ; \
102
117
exit 1; \
103
118
fi
104
119
120
+
105
121
.PHONY : serve
106
122
serve :
107
- $(MAKE ) -C $(CPYTHON_PATH ) /Doc/ serve
108
-
109
-
110
- .PHONY : progress
111
- progress :
112
- ifeq ($(file ) ,)
113
- @echo "No file specified, showing total progress"; \
114
- $(PYTHON) -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
115
- $(shell msgcat *.po */*.po | msgattrib --translated | grep -c '^msgid') \
116
- $(shell msgcat *.po */*.po | grep -c '^msgid')
117
-
123
+ ifdef SERVE_PORT
124
+ $(MAKE) -C venv/cpython/Doc/ serve SERVE_PORT=$(SERVE_PORT)
118
125
else
119
- @$(PYTHON) -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
120
- $(shell msgcat $(file) | msgattrib --translated | grep -c '^msgid') \
121
- $(shell msgcat $(file) | grep -c '^msgid')
126
+ $(MAKE) -C venv/cpython/Doc/ serve
122
127
endif
123
128
124
-
125
129
.PHONY : todo
126
130
todo : ensure_prerequisites
127
131
potodo --exclude venv .venv $(EXCLUDED )
128
132
129
133
.PHONY : wrap
130
134
wrap : ensure_prerequisites
131
- ifeq ($(fix ) ,)
132
- @echo "Verify wrapping"
133
- powrap --check --quiet *.po **/*.po
134
-
135
- else
136
- ifeq ($(file ) ,)
137
- @echo "Checking and fixing wrapping"
138
- powrap *.po **/*.po
139
- else
140
- @echo "Fixing wrapping in $(file)"
141
- powrap $(file)
142
- endif
143
- endif
135
+ @echo " Re wrapping modified files"
136
+ powrap -m
144
137
145
138
SRCS = $(shell git diff --name-only $(BRANCH ) | grep '.po$$')
146
139
# foo/bar.po => $(POSPELL_TMP_DIR)/foo/bar.po.out
@@ -152,41 +145,19 @@ spell: ensure_prerequisites $(DESTS)
152
145
$(POSPELL_TMP_DIR ) /% .po.out : % .po dict
153
146
@echo " Pospell checking $<..."
154
147
mkdir -p $(@D )
155
- pospell -p dict -l fr_FR $< && touch $@
148
+ pospell -p dict -l tr_TR $< && touch $@
156
149
157
150
.PHONY : fuzzy
158
151
fuzzy : ensure_prerequisites
159
152
potodo -f --exclude venv .venv $(EXCLUDED )
160
153
161
154
.PHONY : verifs
162
- verifs : wrap spell
163
-
164
- .PHONY : merge
165
- merge : ensure_prerequisites
166
- @echo " Merge from $( UPSTREAM) "
167
- git -C $(CPYTHON_PATH ) checkout $(BRANCH )
168
- git -C $(CPYTHON_PATH ) pull --ff-only
169
- (cd $( CPYTHON_PATH) /Doc; sphinx-build -Q -b gettext -D gettext_compact=0 . ../pot)
170
- find $(CPYTHON_PATH ) /pot/ -name ' *.pot' | \
171
- while read -r POT; \
172
- do \
173
- PO=" ./$$ (echo " $$ POT" | sed " s#$(CPYTHON_PATH ) /pot/# #; s#\.pot\$$#.po#")"; \
174
- mkdir -p " $$ (dirname " $$ PO" )" ; \
175
- if [ -f " $$ PO" ]; \
176
- then \
177
- msgmerge --backup=off --force-po -U " $$ PO" " $$ POT" ; \
178
- else \
179
- msgcat -o " $$ PO" " $$ POT" ; \
180
- fi \
181
- done
182
- rm -fr $(CPYTHON_PATH ) /pot/
183
- sed -i ' s|^#: .*Doc/|#: |' * .po * /* .po
184
- powrap -m
185
- @printf " \n%s %s\n" " Replace CPYTHON_CURRENT_COMMIT in Makefile by: " $(shell git -C $(CPYTHON_PATH ) rev-parse HEAD)
186
- @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'
155
+ verifs : spell
187
156
188
157
.PHONY : clean
189
158
clean :
190
159
@echo " Cleaning *.mo and $( POSPELL_TMP_DIR) "
191
- rm -fr $(POSPELL_TMP_DIR )
160
+ rm -rf $(POSPELL_TMP_DIR )
192
161
find -name ' *.mo' -delete
162
+ @echo " Cleaning build directory"
163
+ $(MAKE ) -C venv/cpython/Doc/ clean
0 commit comments