Skip to content

Commit 88c4f4c

Browse files
authored
Pequeñas mejoras al proceso de construcción (#2874)
Éstos son pequeños cambios que mejoran ligeramente el proceso de la construcción de la documentación, y hacen más mantenible el código a futuro. Primero, la lista de rutas relativas que hay que arreglar en los .rst de cpython ha sido simplificada, removiendo entradas innecesarias, y actualizando sólo los archivos que haga falta (en vez de ejecturas cada actualización sobre todos los archivos cada vez). Segundo, el target `build` del Makefile fue separado en sus sub-partes constituyentes, de tal modo que ahora en el step de CI donde antes teníamos una copia de los comandos `sed` ahora hay sólo una invocación a `make fix_relative_paths`. Finalmente, el PR que envié a `sphinx-intl` para realizar updates en paralelo [ya está aceptado](sphinx-doc/sphinx-intl#110) y una nueva versión ya fue publicada, por lo que la lista de requisitos ahora está actualizada para usar esa última versión (y así hacer más rápido el proceso de actualización a 3.13). --------- Signed-off-by: Rodrigo Tobar <[email protected]>
1 parent de16a1a commit 88c4f4c

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ jobs:
8888
# Construcción de la documentación
8989
- name: Construir documentación
9090
run: |
91-
# FIXME: Relative paths for includes in 'cpython'
92-
sed -i -e 's|.. include:: ../includes/wasm-notavail.rst|.. include:: ../../../../includes/wasm-notavail.rst|g' cpython/Doc/**/*.rst
93-
sed -i -e 's|.. include:: ../distutils/_setuptools_disclaimer.rst|.. include:: ../../../../distutils/_setuptools_disclaimer.rst|g' cpython/Doc/**/*.rst
94-
sed -i -e 's|.. include:: ./_setuptools_disclaimer.rst|.. include:: ../../../_setuptools_disclaimer.rst|g' cpython/Doc/**/*.rst
95-
sed -i -e 's|.. include:: token-list.inc|.. include:: ../../../token-list.inc|g' cpython/Doc/**/*.rst
96-
sed -i -e 's|.. include:: ../../using/venv-create.inc|.. include:: ../using/venv-create.inc|g' cpython/Doc/**/*.rst
97-
sed -i -e 's|.. include:: ../../../using/venv-create.inc|.. include:: ../../using/venv-create.inc|g' cpython/Doc/**/*.rst
98-
sed -i -e 's|.. include:: /using/venv-create.inc|.. include:: ../../../../using/venv-create.inc|g' cpython/Doc/**/*.rst
91+
make fix_relative_paths
9992
# Normal build
10093
PYTHONWARNINGS=ignore::FutureWarning,ignore::RuntimeWarning sphinx-build -j auto -W --keep-going -b html -d cpython/Doc/_build/doctree -D language=es . cpython/Doc/_build/html

Makefile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ OUTPUT_DOCTREE := $(CPYTHON_WORKDIR)/Doc/build/doctree
2020
OUTPUT_HTML := $(CPYTHON_WORKDIR)/Doc/build/html
2121
LOCALE_DIR := $(CPYTHON_WORKDIR)/locale
2222
POSPELL_TMP_DIR := .pospell
23+
SPHINX_JOBS := auto
2324

2425

2526
.PHONY: help
@@ -38,21 +39,22 @@ help:
3839
# before this. If passing SPHINXERRORHANDLING='', warnings will not be
3940
# treated as errors, which is good to skip simple Sphinx syntax mistakes.
4041
.PHONY: build
41-
build: setup
42-
# FIXME: Relative paths for includes in 'cpython'
43-
# See more about this at https://github.com/python/python-docs-es/issues/1844
44-
sed -i -e 's|.. include:: ../includes/wasm-notavail.rst|.. include:: ../../../../includes/wasm-notavail.rst|g' cpython/Doc/**/*.rst
45-
sed -i -e 's|.. include:: ../distutils/_setuptools_disclaimer.rst|.. include:: ../../../../distutils/_setuptools_disclaimer.rst|g' cpython/Doc/**/*.rst
46-
sed -i -e 's|.. include:: ./_setuptools_disclaimer.rst|.. include:: ../../../_setuptools_disclaimer.rst|g' cpython/Doc/**/*.rst
47-
sed -i -e 's|.. include:: token-list.inc|.. include:: ../../../token-list.inc|g' cpython/Doc/**/*.rst
48-
sed -i -e 's|.. include:: ../../using/venv-create.inc|.. include:: ../using/venv-create.inc|g' cpython/Doc/**/*.rst
49-
sed -i -e 's|.. include:: ../../../using/venv-create.inc|.. include:: ../../using/venv-create.inc|g' cpython/Doc/**/*.rst
50-
sed -i -e 's|.. include:: /using/venv-create.inc|.. include:: ../../../../using/venv-create.inc|g' cpython/Doc/**/*.rst
42+
build: setup fix_relative_paths do_build
43+
44+
.PHONY: do_build
45+
do_build:
5146
# Normal build
52-
PYTHONWARNINGS=ignore::FutureWarning,ignore::RuntimeWarning $(VENV)/bin/sphinx-build -j auto -W --keep-going -b html -d $(OUTPUT_DOCTREE) -D language=$(LANGUAGE) . $(OUTPUT_HTML) && \
47+
PYTHONWARNINGS=ignore::FutureWarning,ignore::RuntimeWarning $(VENV)/bin/sphinx-build -j $(SPHINX_JOBS) -W --keep-going -b html -d $(OUTPUT_DOCTREE) -D language=$(LANGUAGE) . $(OUTPUT_HTML) && \
5348
echo "Success! Open file://`pwd`/$(OUTPUT_HTML)/index.html, " \
5449
"or run 'make serve' to see them in http://localhost:8000";
5550

51+
.PHONY: fix_relative_paths
52+
fix_relative_paths:
53+
# FIXME: Relative paths for includes in 'cpython'
54+
# See more about this at https://github.com/python/python-docs-es/issues/1844
55+
sed -i -e 's|.. include:: ../includes/wasm-notavail.rst|.. include:: ../../../../includes/wasm-notavail.rst|g' cpython/Doc/**/*.rst
56+
sed -i -e 's|.. include:: token-list.inc|.. include:: ../../../token-list.inc|g' cpython/Doc/library/token.rst
57+
sed -i -e 's|.. include:: /using/venv-create.inc|.. include:: ../../../../using/venv-create.inc|g' cpython/Doc/library/venv.rst
5658

5759
# setup: After running "venv" target, prepare that virtual environment with
5860
# a local clone of cpython repository and the translation files.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ potodo
1010
powrap
1111
python-docs-theme>=2022.1
1212
setuptools
13-
sphinx-intl
13+
sphinx-intl>=2.3.0
1414
pre-commit
1515
sphinx-autorun
1616
sphinxemoji

0 commit comments

Comments
 (0)