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

Commita726946

Browse files
committed
add Makefile
This makefile is copied from python-docs-bootstrapperhttps://github.com/python-docs-translations/python-docs-bootstrapper
1 parentbce1eea commita726946

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

‎Makefile

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Makefile for ja Python Documentation
2+
#
3+
# Here is what you can do:
4+
#
5+
# - make # Automatically build an HTML local version
6+
# - make todo # To list remaining tasks and show current progression
7+
# - make verifs # To check for correctness: wrapping, spelling
8+
# - make wrap # To rewrap modified files
9+
# - make spell # To check for spelling
10+
# - make clean # To remove build artifacts
11+
# - make fuzzy # To find fuzzy strings
12+
#
13+
# Modes are: autobuild-stable, autobuild-dev, and autobuild-html
14+
15+
# Configuration
16+
17+
# The CPYTHON_CURRENT_COMMIT is the commit, in the cpython repository,
18+
# from which we generated our po files. We use it here so when we
19+
# test build, we're building with the .rst files that generated our
20+
# .po files.
21+
22+
CPYTHON_CURRENT_COMMIT := 16187b58bff9ccf6f800ba908ad5dae441fcb6a1
23+
LANGUAGE := ja
24+
BRANCH := 3.14
25+
26+
EXCLUDED :=\
27+
whatsnew/2.?.po\
28+
whatsnew/3.[0-10].po
29+
30+
# Internal variables
31+
32+
UPSTREAM := https://github.com/python/cpython
33+
34+
PYTHON :=$(shell which python3)
35+
MODE := html
36+
POSPELL_TMP_DIR := .pospell/
37+
JOBS := auto
38+
ADDITIONAL_ARGS := --keep-going --color
39+
SPHINXERRORHANDLING = -W
40+
41+
# Detect OS
42+
43+
ifeq '$(findstring ;,$(PATH))' ';'
44+
detected_OS := Windows
45+
else
46+
detected_OS :=$(shell uname 2>/dev/null || echo Unknown)
47+
detected_OS :=$(patsubst CYGWIN%,Cygwin,$(detected_OS))
48+
detected_OS :=$(patsubst MSYS%,MSYS,$(detected_OS))
49+
detected_OS :=$(patsubst MINGW%,MSYS,$(detected_OS))
50+
endif
51+
52+
ifeq ($(detected_OS),Darwin)# Mac OS X
53+
CP_CMD := gcp# accessible with `brew install coreutils` or `brew upgrade coreutils`
54+
else
55+
CP_CMD := cp
56+
endif
57+
58+
.PHONY: all
59+
all: ensure_prerequisites
60+
git -C venv/cpython checkout$(CPYTHON_CURRENT_COMMIT)|| (git -C venv/cpython fetch&& git -C venv/cpython checkout$(CPYTHON_CURRENT_COMMIT))
61+
mkdir -p locales/$(LANGUAGE)/LC_MESSAGES/
62+
$(CP_CMD) -u --parents*.po*/*.po locales/$(LANGUAGE)/LC_MESSAGES/
63+
$(MAKE) -C venv/cpython/Doc/\
64+
JOBS='$(JOBS)'\
65+
SPHINXOPTS='-D locale_dirs=$(abspath locales) \
66+
-D language=$(LANGUAGE)\
67+
-D gettext_compact=0\
68+
-D latex_engine=xelatex\
69+
-D latex_elements.inputenc=\
70+
-D latex_elements.fontenc=\
71+
$(ADDITIONAL_ARGS)' \
72+
SPHINXERRORHANDLING=$(SPHINXERRORHANDLING)\
73+
$(MODE)
74+
@echo"Build success, open file://$(abspath venv/cpython/)/Doc/build/html/index.html or run 'make htmlview' to see them."
75+
76+
77+
# We clone cpython/ inside venv/ because venv/ is the only directory
78+
# excluded by cpython' Sphinx configuration.
79+
venv/cpython/.git/HEAD:
80+
git clone https://github.com/python/cpython venv/cpython
81+
82+
83+
.PHONY: ensure_prerequisites
84+
ensure_prerequisites: venv/cpython/.git/HEAD
85+
@if! (blurbhelp>/dev/null2>&1&& sphinx-build --version>/dev/null2>&1);then\
86+
git -C venv/cpython/ checkout$(BRANCH);\
87+
echo"You're missing dependencies please install:";\
88+
echo"";\
89+
echo" python -m pip install -r venv/cpython/Doc/requirements.txt";\
90+
exit 1;\
91+
fi
92+
93+
.PHONY: htmlview
94+
htmlview: MODE=htmlview
95+
htmlview: all
96+
97+
.PHONY: todo
98+
todo: ensure_prerequisites
99+
potodo --exclude venv .venv$(EXCLUDED)
100+
101+
.PHONY: wrap
102+
wrap: ensure_prerequisites
103+
@echo"Re wrapping modified files"
104+
powrap -m
105+
106+
SRCS =$(shell git diff --name-only$(BRANCH) | grep '.po$$')
107+
# foo/bar.po => $(POSPELL_TMP_DIR)/foo/bar.po.out
108+
DESTS =$(addprefix$(POSPELL_TMP_DIR)/,$(addsuffix .out,$(SRCS)))
109+
110+
.PHONY: spell
111+
spell: ensure_prerequisites$(DESTS)
112+
113+
.PHONY: line-length
114+
line-length:
115+
@echo"Searching for long lines..."
116+
@awk'{if (length(gensub(/శ్రీనివాస్/, ".", "g", $$0)) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $$0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'*.po*/*.po
117+
118+
.PHONY: sphinx-lint
119+
sphinx-lint:
120+
@echo"Checking all files using sphinx-lint..."
121+
@sphinx-lint --enable all --disable line-too-long*.po*/*.po
122+
123+
$(POSPELL_TMP_DIR)/%.po.out:%.po dict
124+
@echo"Pospell checking $<..."
125+
@mkdir -p$(@D)
126+
pospell -p dict -l tr_TR$<&& touch$@
127+
128+
.PHONY: fuzzy
129+
fuzzy: ensure_prerequisites
130+
potodo -f --exclude venv .venv$(EXCLUDED)
131+
132+
.PHONY: verifs
133+
verifs: spell line-length sphinx-lint
134+
135+
.PHONY: clean
136+
clean:
137+
@echo"Cleaning *.mo and$(POSPELL_TMP_DIR)"
138+
rm -rf$(POSPELL_TMP_DIR) locales/$(LANGUAGE)/LC_MESSAGES/
139+
find -name'*.mo' -delete
140+
@echo"Cleaning build directory"
141+
$(MAKE) -C venv/cpython/Doc/ clean

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp