Skip to content

Commit 3ecbb9b

Browse files
authored
Omitir directorio .overrides/logo para ln y mejoras (#1840)
- Se omite el directorio logo, para que `ln` no genere warnings. - Se cambian algunas cosas en el archivo `conf.py` para solucionar algunos warnings de flake8
1 parent d3518a3 commit 3ecbb9b

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

conf.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@
1313
#
1414
# $ sphinx-build -b html -d _build/doctrees -D language=es . _build/html
1515

16-
import sys, os, time
16+
import sys
17+
import os
18+
import time
1719
sys.path.append(os.path.abspath('cpython/Doc/tools/extensions'))
1820
sys.path.append(os.path.abspath('cpython/Doc/includes'))
1921

2022
# Import all the Sphinx settings from cpython
23+
# This import will trigger warnings on the 'Include/patchlevel.h'
24+
# not being found, because it execute the content of the whole file,
25+
# and there there is a local call to 'get_header_version' like the one
26+
# we have in a few lines.
2127
sys.path.insert(0, os.path.abspath('cpython/Doc'))
2228
from conf import *
2329

2430
# Call patchlevel with the proper path to get the version from
2531
# instead of hardcoding it
26-
import patchlevel
27-
version, release = patchlevel.get_header_version_info(os.path.abspath('cpython/Doc'))
32+
from patchlevel import get_header_version_info
33+
version, release = get_header_version_info(os.path.abspath('cpython/Doc'))
2834

2935
project = 'Python en Español'
30-
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
36+
year = time.strftime("%Y")
37+
copyright = f'2001-{year}, Python Software Foundation'
3138

3239
html_theme_path = ['cpython/Doc/tools']
3340
templates_path = ['cpython/Doc/tools/templates']
@@ -61,14 +68,18 @@
6168
extensions = _extensions
6269

6370

64-
if not os.environ.get('SPHINX_GETTEXT') == 'True':
71+
if os.environ.get('SPHINX_GETTEXT') is None:
6572
# Override all the files from ``.overrides`` directory
6673
from pathlib import Path
6774
overrides_paths = Path('.overrides')
6875

6976
for path in overrides_paths.glob('**/*.*'):
7077
if path.name == 'README.rst' and path.parent == '.overrides':
7178
continue
79+
# Skip the files in the .overrides/logo directory
80+
# to avoid ln issues.
81+
if str(path.parent).endswith("logo"):
82+
continue
7283
destroot = str(path.parent).replace('.overrides', '').lstrip('/')
7384
outputdir = Path('cpython/Doc') / destroot / path.name
7485
os.system(f'ln -nfs `pwd`/{path.parent}/{path.name} {outputdir}')
@@ -85,6 +96,7 @@
8596
_stdauthor, 'manual'),
8697
]
8798

99+
88100
def setup(app):
89101

90102
def add_contributing_banner(app, doctree):
@@ -101,10 +113,13 @@ def add_contributing_banner(app, doctree):
101113
return
102114

103115
from docutils import nodes, core
116+
from textwrap import dedent
104117

105-
message = '¡Ayúdanos a traducir la documentación oficial de Python al Español! ' \
106-
f'Puedes encontrar más información en `Como contribuir </es/{version}/CONTRIBUTING.html>`_. ' \
107-
'Ayuda a acercar Python a más personas de habla hispana.'
118+
message = dedent(f"""\
119+
¡Ayúdanos a traducir la documentación oficial de Python al Español!
120+
Puedes encontrar más información en `Como contribuir </es/{version}/CONTRIBUTING.html>`_.
121+
Ayuda a acercar Python a más personas de habla hispana.
122+
""")
108123

109124
paragraph = core.publish_doctree(message)[0]
110125
banner = nodes.note(ids=['contributing-banner'])

0 commit comments

Comments
 (0)