Skip to content

Commit

Permalink
refactor(make): make 3.12 as default build version
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwang44 committed Jun 2, 2024
1 parent c1af59e commit e54aa0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ endef
export PRINT_HELP_PYSCRIPT # End of python section

CPYTHON_CLONE := ../cpython
VERSION := $(or $(VERSION), 3.12)
SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
LANGUAGE := zh_TW
LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
VENV := ~/.venvs/python-docs-i18n/
PYTHON := $(shell which python3)
MODE := autobuild-dev-html
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
JOBS := 4

.PHONY: all
Expand Down Expand Up @@ -82,7 +82,7 @@ help:

clone: ## Clone latest cpython repository to `../cpython/` if it doesn't exist
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)
cd $(CPYTHON_CLONE) && git checkout $(VERSION)


$(VENV)/bin/activate:
Expand Down Expand Up @@ -119,9 +119,6 @@ todo: ## List remaining tasks

.PHONY: merge
merge: upgrade_venv ## To merge pot from upstream
ifneq "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" "$(BRANCH)"
$(error "You're merging from a different branch")
endif
(cd $(CPYTHON_CLONE)/Doc; rm -f build/NEWS)
(cd $(CPYTHON_CLONE)/Doc; $(VENV)/bin/sphinx-build -Q -b gettext -D gettext_compact=0 . locales/pot/)
find $(CPYTHON_CLONE)/Doc/locales/pot/ -name '*.pot' |\
Expand All @@ -140,7 +137,7 @@ endif

.PHONY: update_txconfig
update_txconfig:
curl -L https://rawgit.com/python-doc-ja/cpython-doc-catalog/catalog-$(BRANCH)/Doc/locales/.tx/config |\
curl -L https://rawgit.com/python-doc-ja/cpython-doc-catalog/catalog-$(VERSION)/Doc/locales/.tx/config |\
grep --invert-match '^file_filter = *' |\
sed -e 's/source_file = pot\/\(.*\)\.pot/trans.zh_TW = \1.po/' |\
sed -n 'w .tx/config'
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ the PSF for inclusion in the documentation.

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

VERSION=3.12 make all
make all

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

VERSION=3.12 make lint
make lint

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

在 ``make all`` 後,可以使用 ``make build`` 來只對單一 ``.po`` 檔進行編譯,可以節省較多的時間 ::

VERSION=3.12 make build glossary.po
make build glossary.po

如果你還沒有執行 `維護、預覽`_ 的 clone CPython 的動作,此指令會自動幫你 clone CPython,\
並且會使用 Sphinx 幫你檢查 reST 語法錯誤,我們盡量保持沒有 warning \
Expand Down

0 comments on commit e54aa0a

Please sign in to comment.