Skip to content

Commit 711f899

Browse files
authored
Merge pull request python#24 from humitos/readthedocs
Build on Read the Docs
2 parents 9df4d9b + 309ef1f commit 711f899

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.mo
2+
/_build/

.gitmodules

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[submodule "cpython"]
2+
path = cpython
3+
url = https://github.com/python/cpython.git
4+
branch = 3.7
5+
shallow = true

.readthedocs.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: conf.py
11+
12+
# Optionally set the version of Python and requirements required to build your docs
13+
python:
14+
version: 3.7
15+
install:
16+
- requirements: requirements.txt
17+
18+
submodules:
19+
include: all

conf.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Sphinx configuration file.
2+
#
3+
# - import original configurations from cpython/Doc/conf.py
4+
# - append the path considering the cpython submodule is at ./cpython
5+
# - create the symbolic links under ./cpython/locale/es/LC_MESSAGES
6+
# - make the build to work under Read the Docs
7+
#
8+
# The git submodule was created using this Stack Overflow answer
9+
# to fetch only the commit that I needed and avoid clonning the whole history
10+
# https://stackoverflow.com/a/27445058
11+
#
12+
# This can be built locally using `sphinx-build` by running
13+
#
14+
# $ sphinx-build -b html -n -d _build/doctrees -D language=es . _build/html
15+
16+
import sys, os, time
17+
sys.path.append(os.path.abspath('cpython/Doc/tools/extensions'))
18+
sys.path.append(os.path.abspath('cpython/Doc/includes'))
19+
20+
# Import all the Sphinx settings from cpython
21+
sys.path.append(os.path.abspath('cpython/Doc'))
22+
from conf import *
23+
24+
version = '3.7'
25+
release = '3.7.7'
26+
27+
project = 'Python en Español'
28+
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
29+
30+
html_theme_path = ['cpython/Doc/tools']
31+
templates_path = ['cpython/Doc/tools/templates']
32+
html_static_path = ['cpython/Doc/tools/static']
33+
34+
os.system('mkdir -p cpython/locales/es/')
35+
os.system('ln -nfs `pwd` cpython/locales/es/LC_MESSAGES')
36+
37+
gettext_compact = False
38+
locale_dirs = ['../locales', 'cpython/locales'] # relative to the sourcedir
39+
40+
def setup(app):
41+
# Change the sourcedir programmatically because Read the Docs always call it with `.`
42+
app.srcdir = 'cpython/Doc'

cpython

Submodule cpython added at 48ef06b

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Sphinx==2.2.0
2+
setuptools
3+
blurb
4+
python-docs-theme

0 commit comments

Comments
 (0)