13
13
#
14
14
# $ sphinx-build -b html -d _build/doctrees -D language=es . _build/html
15
15
16
- import sys , os , time
16
+ import sys
17
+ import os
18
+ import time
17
19
sys .path .append (os .path .abspath ('cpython/Doc/tools/extensions' ))
18
20
sys .path .append (os .path .abspath ('cpython/Doc/includes' ))
19
21
20
22
# 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.
21
27
sys .path .insert (0 , os .path .abspath ('cpython/Doc' ))
22
28
from conf import *
23
29
24
30
# Call patchlevel with the proper path to get the version from
25
31
# 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' ))
28
34
29
35
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'
31
38
32
39
html_theme_path = ['cpython/Doc/tools' ]
33
40
templates_path = ['cpython/Doc/tools/templates' ]
61
68
extensions = _extensions
62
69
63
70
64
- if not os .environ .get ('SPHINX_GETTEXT' ) == 'True' :
71
+ if os .environ .get ('SPHINX_GETTEXT' ) is None :
65
72
# Override all the files from ``.overrides`` directory
66
73
from pathlib import Path
67
74
overrides_paths = Path ('.overrides' )
68
75
69
76
for path in overrides_paths .glob ('**/*.*' ):
70
77
if path .name == 'README.rst' and path .parent == '.overrides' :
71
78
continue
79
+ # Skip the files in the .overrides/logo directory
80
+ # to avoid ln issues.
81
+ if str (path .parent ).endswith ("logo" ):
82
+ continue
72
83
destroot = str (path .parent ).replace ('.overrides' , '' ).lstrip ('/' )
73
84
outputdir = Path ('cpython/Doc' ) / destroot / path .name
74
85
os .system (f'ln -nfs `pwd`/{ path .parent } /{ path .name } { outputdir } ' )
85
96
_stdauthor , 'manual' ),
86
97
]
87
98
99
+
88
100
def setup (app ):
89
101
90
102
def add_contributing_banner (app , doctree ):
@@ -101,10 +113,13 @@ def add_contributing_banner(app, doctree):
101
113
return
102
114
103
115
from docutils import nodes , core
116
+ from textwrap import dedent
104
117
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
+ """ )
108
123
109
124
paragraph = core .publish_doctree (message )[0 ]
110
125
banner = nodes .note (ids = ['contributing-banner' ])
0 commit comments