Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88e881c

Browse files
committed
refactor(make): organize preparation directives
1 parent e54aa0a commit 88e881c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ MODE := autobuild-dev-html
4848
JOBS := 4
4949

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

5756
.PHONY: build
58-
build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version for a single file
57+
build: prepare_deps ## Automatically build an html local version for a single file
5958
@$(eval target=$(filter-out $@,$(MAKECMDGOALS)))
6059
@if [ -z $(target) ]; then \
6160
echo "\x1B[1;31m""Please provide a file argument.""\x1B[m"; \
@@ -80,16 +79,20 @@ build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build a
8079
help:
8180
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
8281

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

8791

8892
$(VENV)/bin/activate:
8993
mkdir -p $(VENV)
9094
$(PYTHON) -m venv $(VENV)
9195

92-
9396
$(VENV)/bin/sphinx-build: $(VENV)/bin/activate
9497
. $(VENV)/bin/activate; python3 -m pip install sphinx python-docs-theme
9598

@@ -102,7 +105,7 @@ $(VENV)/bin/blurb: $(VENV)/bin/activate
102105

103106
.PHONY: upgrade_venv
104107
upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc
105-
. $(VENV)/bin/activate; python3 -m pip install --upgrade sphinx python-docs-theme blurb sphinx-lint
108+
@. $(VENV)/bin/activate; python3 -m pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint
106109

107110

108111
.PHONY: progress
@@ -118,7 +121,7 @@ todo: ## List remaining tasks
118121

119122

120123
.PHONY: merge
121-
merge: upgrade_venv ## To merge pot from upstream
124+
merge: prepare_deps ## To merge pot from upstream
122125
(cd $(CPYTHON_CLONE)/Doc; rm -f build/NEWS)
123126
(cd $(CPYTHON_CLONE)/Doc; $(VENV)/bin/sphinx-build -Q -b gettext -D gettext_compact=0 . locales/pot/)
124127
find $(CPYTHON_CLONE)/Doc/locales/pot/ -name '*.pot' |\

0 commit comments

Comments
 (0)