Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cdc2562

Browse filesBrowse files
authored
docs(makefile): add autodocumenting to makefile (#239)
1 parent 3391edc commit cdc2562
Copy full SHA for cdc2562

File tree

Expand file treeCollapse file tree

4 files changed

+35
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+35
-13
lines changed
Open diff view settings
Collapse file

‎.github/workflows/ci.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
run: sudo apt-get install gettext
1919

2020
- name: Validate
21-
run: VERSION=${{ github.event.pull_request.base.ref }} MODE=dummy make
21+
run: VERSION=${{ github.event.pull_request.base.ref }} MODE=dummy make all
Collapse file

‎.github/workflows/deploy-gh-page.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/deploy-gh-page.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
run: sudo apt-get install gettext
1616

1717
- name: Build
18-
run: make
18+
run: make all
1919

2020
- name: Deploy to gh page
2121
uses: JamesIves/github-pages-deploy-action@3.7.1
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+32-10Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Here is what you can do:
44
#
5-
# - make # Automatically build an html local version
5+
# - make all # Automatically build an html local version
66
# - make todo # To list remaining tasks
77
# - make merge # To merge pot from upstream
88
# - make fuzzy # To find fuzzy strings
@@ -15,6 +15,27 @@
1515
#
1616
# Credits: Python Documentation French Translation Team (https://github.com/python/python-docs-fr)
1717

18+
.DEFAULT_GOAL := help # Sets default action to be help
19+
20+
define PRINT_HELP_PYSCRIPT # start of Python section
21+
import re, sys
22+
23+
output = []
24+
# Loop through the lines in this file
25+
for line in sys.stdin:
26+
# if the line has a command and a comment start with
27+
# two pound signs, add it to the output
28+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
29+
if match:
30+
target, help = match.groups()
31+
output.append("%-10s %s" % (target, help))
32+
# Sort the output in alphanumeric order
33+
output.sort()
34+
# Print the help result
35+
print('\n'.join(output))
36+
endef
37+
export PRINT_HELP_PYSCRIPT # End of python section
38+
1839
CPYTHON_CLONE := ../cpython/
1940
SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
2041
LANGUAGE := zh_TW
@@ -25,16 +46,17 @@ MODE := autobuild-dev-html
2546
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
2647
JOBS := 4
2748

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

56+
help:
57+
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
3658

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

@@ -53,24 +75,24 @@ $(VENV)/bin/blurb: $(VENV)/bin/activate
5375

5476

5577
.PHONY: upgrade_venv
56-
upgrade_venv: $(VENV)/bin/activate
78+
upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc
5779
. $(VENV)/bin/activate; python3 -m pip install --upgrade sphinx python-docs-theme blurb
5880

5981

6082
.PHONY: progress
61-
progress:
83+
progress: ## Compute current progression
6284
@python3 -c 'import sys; print("{:.1%}".format(int(sys.argv[1]) / int(sys.argv[2])))' \
6385
$(shell msgcat *.po */*.po | msgattrib --translated | grep -c '^msgid') \
6486
$(shell msgcat *.po */*.po | grep -c '^msgid')
6587

6688

6789
.PHONY: todo
68-
todo:
90+
todo: ## List remaining tasks
6991
for file in *.po */*.po; do echo $$(msgattrib --untranslated $$file | grep ^msgid | sed 1d | wc -l ) $$file; done | grep -v ^0 | sort -gr
7092

7193

7294
.PHONY: merge
73-
merge: upgrade_venv
95+
merge: upgrade_venv ## To merge pot from upstream
7496
ifneq "$(shell cd $(CPYTHON_CLONE) 2>/dev/null && git describe --contains --all HEAD)" "$(BRANCH)"
7597
$(error "You're merging from a different branch")
7698
endif
@@ -102,9 +124,9 @@ update_txconfig:
102124

103125

104126
.PHONY: fuzzy
105-
fuzzy:
127+
fuzzy: ## Find fuzzy strings
106128
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr
107129

108130
.PHONY: rm_cpython
109-
rm_cpython:
131+
rm_cpython: ## Remove cloned cpython repo
110132
rm -rf $(CPYTHON_CLONE)
Collapse file

‎README.rst‎

Copy file name to clipboardExpand all lines: README.rst
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ the PSF for inclusion in the documentation.
132132

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

135-
make
135+
make all
136136

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.