Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitfb64a75

Browse files
committed
docs(makefile): add autodocumenting to makefile
1 parent6a67bb6 commitfb64a75

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

‎Makefile

Lines 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+
# - makeall # 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+
definePRINT_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+
exportPRINT_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
fordirnamein$$(find. -name'*.po'| xargs -n1 dirname| sort -u| grep -v'^\.$$');do mkdir -p$(LC_MESSAGES)/$$dirname;done
3353
forfilein*.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
forfilein*.po*/*.po;doecho$$(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
forfilein*.po*/*.po;doecho$$(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)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp