Skip to content

Commit 476880f

Browse files
authored
Merge branch '3.12' into cron/sync/3.12
2 parents a5e5866 + 1a30c43 commit 476880f

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

Makefile

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Here is what you can do:
44
#
55
# - make all # Automatically build an html local version
6+
# - make build <po-file> # To build a single .po file
67
# - make todo # To list remaining tasks
78
# - make merge # To merge pot from upstream
89
# - make fuzzy # To find fuzzy strings
@@ -36,25 +37,23 @@ print('\n'.join(output))
3637
endef
3738
export PRINT_HELP_PYSCRIPT # End of python section
3839

39-
CPYTHON_CLONE := ../cpython/
40+
CPYTHON_CLONE := ../cpython
41+
VERSION := $(or $(VERSION), 3.12)
4042
SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
4143
LANGUAGE := zh_TW
4244
LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
4345
VENV := ~/.venvs/python-docs-i18n/
44-
PYTHON := $(shell which python3)
4546
MODE := autobuild-dev-html
46-
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
4747
JOBS := 4
4848

4949
.PHONY: all
50-
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
51-
mkdir -p $(LC_MESSAGES)
50+
all: prepare_deps ## Automatically build an html local version
5251
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
5352
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
5453
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
5554

5655
.PHONY: build
57-
build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
56+
build: prepare_deps ## Automatically build an html local version for a single file
5857
@$(eval target=$(filter-out $@,$(MAKECMDGOALS)))
5958
@if [ -z $(target) ]; then \
6059
echo "\x1B[1;31m""Please provide a file argument.""\x1B[m"; \
@@ -68,32 +67,29 @@ build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build a
6867
echo "\x1B[1;31m""ERROR: $(target) not exist.""\x1B[m"; \
6968
exit 1; \
7069
fi
71-
@mkdir -p $(LC_MESSAGES)
70+
7271
@$(eval dir=`echo $(target) | xargs -n1 dirname`) ## Get dir
73-
# If the build target is in under directory
74-
# We should make direcotry in $(LC_MESSAGES) and link the file.
75-
@if [ $(dir) != "." ]; then \
76-
echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
77-
mkdir -p $(LC_MESSAGES)/$(dir); \
78-
echo "ln -f ./$(target) $(LC_MESSAGES)/$(target)"; \
79-
ln -f ./$(target) $(LC_MESSAGES)/$(target); \
80-
fi
81-
# Build
82-
@echo "----"
72+
@mkdir -p $(LC_MESSAGES)/$(dir)
73+
@ln -f ./$(target) $(LC_MESSAGES)/$(target)
74+
8375
@. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0' SOURCES='$(basename $(target)).rst' html
8476

77+
8578
help:
8679
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
8780

88-
clone: ## Clone latest cpython repository to `../cpython/` if it doesn't exist
81+
.PHONY: prepare_deps
82+
prepare_deps: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb upgrade_venv prepare_cpython ## Prepare dependencies
83+
84+
.PHONY: prepare_cpython
85+
prepare_cpython: ## Prepare CPython clone at `../cpython/`.
8986
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
90-
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)
87+
cd $(CPYTHON_CLONE) && git checkout $(VERSION) && git pull origin $(VERSION)
88+
mkdir -p $(LC_MESSAGES)
9189

9290

9391
$(VENV)/bin/activate:
94-
mkdir -p $(VENV)
95-
$(PYTHON) -m venv $(VENV)
96-
92+
python3 -m venv $(VENV)
9793

9894
$(VENV)/bin/sphinx-build: $(VENV)/bin/activate
9995
. $(VENV)/bin/activate; python3 -m pip install sphinx python-docs-theme
@@ -107,7 +103,7 @@ $(VENV)/bin/blurb: $(VENV)/bin/activate
107103

108104
.PHONY: upgrade_venv
109105
upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc
110-
. $(VENV)/bin/activate; python3 -m pip install --upgrade sphinx python-docs-theme blurb sphinx-lint
106+
@. $(VENV)/bin/activate; python3 -m pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint
111107

112108

113109
.PHONY: progress
@@ -123,10 +119,7 @@ todo: ## List remaining tasks
123119

124120

125121
.PHONY: merge
126-
merge: upgrade_venv ## To merge pot from upstream
127-
ifneq "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" "$(BRANCH)"
128-
$(error "You're merging from a different branch")
129-
endif
122+
merge: prepare_deps ## To merge pot from upstream
130123
(cd $(CPYTHON_CLONE)/Doc; rm -f build/NEWS)
131124
(cd $(CPYTHON_CLONE)/Doc; $(VENV)/bin/sphinx-build -Q -b gettext -D gettext_compact=0 . locales/pot/)
132125
find $(CPYTHON_CLONE)/Doc/locales/pot/ -name '*.pot' |\
@@ -145,7 +138,7 @@ endif
145138

146139
.PHONY: update_txconfig
147140
update_txconfig:
148-
curl -L https://rawgit.com/python-doc-ja/cpython-doc-catalog/catalog-$(BRANCH)/Doc/locales/.tx/config |\
141+
curl -L https://rawgit.com/python-doc-ja/cpython-doc-catalog/catalog-$(VERSION)/Doc/locales/.tx/config |\
149142
grep --invert-match '^file_filter = *' |\
150143
sed -e 's/source_file = pot\/\(.*\)\.pot/trans.zh_TW = \1.po/' |\
151144
sed -n 'w .tx/config'

README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,18 @@ the PSF for inclusion in the documentation.
142142

143143
3. 存檔以後,執行以下列指令編譯輸出完整文件,以確保你的修改沒有 reST 的語法錯誤或警告 ::
144144

145-
VERSION=3.12 make all
145+
make all
146146

147147
或者只想快速檢查是否有 reST 語法錯誤 ::
148148

149-
VERSION=3.12 make lint
149+
make lint
150150

151151
確保輸出中沒有任何關於正在翻譯的檔案的警告訊息。
152152

153+
在 ``make all`` 後,可以使用 ``make build`` 來只對單一 ``.po`` 檔進行編譯,可以節省較多的時間 ::
154+
155+
make build glossary.po
156+
153157
如果你還沒有執行 `維護、預覽`_ 的 clone CPython 的動作,此指令會自動幫你 clone CPython,\
154158
並且會使用 Sphinx 幫你檢查 reST 語法錯誤,我們盡量保持沒有 warning \
155159
的狀態,因此如果有出現 warning 的話請修復它。另外也記得檢查是否符合\

library/ssl.po

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,20 +1158,22 @@ msgid ""
11581158
"List of supported TLS channel binding types. Strings in this list can be "
11591159
"used as arguments to :meth:`SSLSocket.get_channel_binding`."
11601160
msgstr ""
1161+
"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket."
1162+
"get_channel_binding` 的參數。"
11611163

11621164
#: ../../library/ssl.rst:918
11631165
msgid "The version string of the OpenSSL library loaded by the interpreter::"
1164-
msgstr ""
1166+
msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::"
11651167

11661168
#: ../../library/ssl.rst:927
11671169
msgid ""
11681170
"A tuple of five integers representing version information about the OpenSSL "
11691171
"library::"
1170-
msgstr ""
1172+
msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組。"
11711173

11721174
#: ../../library/ssl.rst:937
11731175
msgid "The raw version number of the OpenSSL library, as a single integer::"
1174-
msgstr ""
1176+
msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::"
11751177

11761178
#: ../../library/ssl.rst:950
11771179
msgid ""
@@ -1180,12 +1182,16 @@ msgid ""
11801182
"parameters-6>`_ contains this list and references to the RFCs where their "
11811183
"meaning is defined."
11821184
msgstr ""
1185+
"來自 :rfc:`5246` 和其他文檔的警報描述。`IANA TLS Alert Registry <https://www."
1186+
"iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6>`_ 包"
1187+
"含了此列表以及其含義定義所在的 RFC 的引用。"
11831188

11841189
#: ../../library/ssl.rst:954
11851190
msgid ""
11861191
"Used as the return value of the callback function in :meth:`SSLContext."
11871192
"set_servername_callback`."
11881193
msgstr ""
1194+
"被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。"
11891195

11901196
#: ../../library/ssl.rst:961
11911197
msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants."

0 commit comments

Comments
 (0)