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

Skip to content

Remove include:: replacements hack #2875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove include:: replacements hack
We currently need to replace the include:: directives in the cpython
documentation source files to fix an issue that sphinx/docutils have
with relative source files after changing the app.srcdir in our conf.py.

Instead of doing this, let's define the app.srcdir property as an
absolute path. This removes the issue altogether, yielding a correct
build without the need to modify the documentation source files.

This change seems to have the nice side effect that successive builds
are not incremental rather than starting from scratch.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed Nov 18, 2024
commit 6191d4507da18a36ac8d4cdd0441366e23cf3c29
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,5 @@ jobs:
# Construcción de la documentación
- name: Construir documentación
run: |
make fix_relative_paths
# Normal build
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
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ help:
# before this. If passing SPHINXERRORHANDLING='', warnings will not be
# treated as errors, which is good to skip simple Sphinx syntax mistakes.
.PHONY: build
build: setup fix_relative_paths do_build
build: setup do_build

.PHONY: do_build
do_build:
Expand All @@ -48,14 +48,6 @@ do_build:
echo "Success! Open file://`pwd`/$(OUTPUT_HTML)/index.html, " \
"or run 'make serve' to see them in http://localhost:8000";

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

# setup: After running "venv" target, prepare that virtual environment with
# a local clone of cpython repository and the translation files.
# If the directories exists, only update the cpython repository and
Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def add_contributing_banner(app, doctree):
document.insert(0, banner)

# Change the sourcedir programmatically because Read the Docs always call it with `.`
app.srcdir = 'cpython/Doc'
app.srcdir = os.getcwd() + '/cpython/Doc'

app.connect('doctree-read', add_contributing_banner)

Expand Down