Skip to content

Commit f7b2f36

Browse files
committed
Doc: do not rely on checked-out Sphinx toolchain from svn.python.org anymore
Nowadays it is likely that people will have Sphinx installed, and if not, they will know how to install it. This also simplifies life a lot for distribution packagers, who typically do not want the doc build process to connect to external web resources.
1 parent a3d0ffe commit f7b2f36

File tree

5 files changed

+15
-64
lines changed

5 files changed

+15
-64
lines changed

.hgignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ python-config.py$
2424
reflog.txt$
2525
tags$
2626
Lib/plat-mac/errors.rsrc.df.rsrc
27-
Doc/tools/sphinx/
28-
Doc/tools/docutils/
29-
Doc/tools/jinja/
30-
Doc/tools/jinja2/
31-
Doc/tools/pygments/
3227
Misc/python.pc
3328
Misc/python-config.sh$
3429
Modules/Setup$

Doc/Makefile

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# You can set these variables from the command line.
77
PYTHON = python
8-
SVNROOT = http://svn.python.org/projects
8+
SPHINXBUILD = sphinx-build
99
SPHINXOPTS =
1010
PAPER =
1111
SOURCES =
@@ -21,7 +21,6 @@ ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
2121
help:
2222
@echo "Please use \`make <target>' where <target> is one of"
2323
@echo " clean to remove build files"
24-
@echo " update to update build tools"
2524
@echo " html to make standalone HTML files"
2625
@echo " htmlhelp to make HTML files and a HTML help project"
2726
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@@ -37,30 +36,8 @@ help:
3736
@echo " check to run a check for frequent markup errors"
3837
@echo " serve to serve the documentation on the localhost (8000)"
3938

40-
# Note: if you update versions here, do the same in make.bat and README.txt
41-
checkout:
42-
@if [ ! -d tools/sphinx ]; then \
43-
echo "Checking out Sphinx..."; \
44-
svn checkout $(SVNROOT)/external/Sphinx-1.2/sphinx tools/sphinx; \
45-
fi
46-
@if [ ! -d tools/docutils ]; then \
47-
echo "Checking out Docutils..."; \
48-
svn checkout $(SVNROOT)/external/docutils-0.11/docutils tools/docutils; \
49-
fi
50-
@if [ ! -d tools/jinja2 ]; then \
51-
echo "Checking out Jinja..."; \
52-
svn checkout $(SVNROOT)/external/Jinja-2.3.1/jinja2 tools/jinja2; \
53-
fi
54-
@if [ ! -d tools/pygments ]; then \
55-
echo "Checking out Pygments..."; \
56-
svn checkout $(SVNROOT)/external/Pygments-1.6/pygments tools/pygments; \
57-
fi
58-
59-
update: clean checkout
60-
6139
build: checkout
62-
mkdir -p build/$(BUILDER) build/doctrees
63-
$(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
40+
$(SPHINXBUILD) $(ALLSPHINXOPTS)
6441
@echo
6542

6643
html: BUILDER = html
@@ -120,10 +97,6 @@ htmlview: html
12097

12198
clean:
12299
-rm -rf build/*
123-
-rm -rf tools/sphinx
124-
-rm -rf tools/pygments
125-
-rm -rf tools/jinja2
126-
-rm -rf tools/docutils
127100

128101
dist:
129102
rm -rf dist

Doc/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
# By default, highlight as Python 3.
6262
highlight_language = 'python3'
6363

64+
needs_sphinx = '1.1'
65+
6466

6567
# Options for HTML output
6668
# -----------------------

Doc/make.bat

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@@echo off
22
setlocal
33

4-
set SVNROOT=http://svn.python.org/projects
54
if "%PYTHON%" EQU "" set PYTHON=py -2
65
if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe
76
if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v
@@ -14,15 +13,11 @@ if "%1" EQU "text" goto build
1413
if "%1" EQU "suspicious" goto build
1514
if "%1" EQU "linkcheck" goto build
1615
if "%1" EQU "changes" goto build
17-
if "%1" EQU "checkout" goto checkout
18-
if "%1" EQU "update" goto update
1916

2017
:help
2118
set this=%~n0
2219
echo HELP
2320
echo.
24-
echo %this% checkout
25-
echo %this% update
2621
echo %this% html
2722
echo %this% htmlhelp
2823
echo %this% latex
@@ -33,20 +28,6 @@ echo %this% changes
3328
echo.
3429
goto end
3530

36-
:checkout
37-
svn co %SVNROOT%/external/Sphinx-1.2/sphinx tools/sphinx
38-
svn co %SVNROOT%/external/docutils-0.11/docutils tools/docutils
39-
svn co %SVNROOT%/external/Jinja-2.3.1/jinja2 tools/jinja2
40-
svn co %SVNROOT%/external/Pygments-1.6/pygments tools/pygments
41-
goto end
42-
43-
:update
44-
svn update tools/sphinx
45-
svn update tools/docutils
46-
svn update tools/jinja2
47-
svn update tools/pygments
48-
goto end
49-
5031
:build
5132
if not exist build mkdir build
5233
if not exist build\%1 mkdir build\%1

Doc/tools/sphinxext/pyspecific.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import sphinx
1818
from sphinx.util.nodes import split_explicit_title
19+
from sphinx.util.compat import Directive
1920
from sphinx.writers.html import HTMLTranslator
2021
from sphinx.writers.latex import LaTeXTranslator
2122
from sphinx.locale import versionlabels
@@ -27,7 +28,9 @@
2728
Body.enum.converters['lowerroman'] = \
2829
Body.enum.converters['upperroman'] = lambda x: None
2930

30-
if sphinx.__version__[:3] < '1.2':
31+
SPHINX11 = sphinx.__version__[:3] < '1.2'
32+
33+
if SPHINX11:
3134
# monkey-patch HTML translator to give versionmodified paragraphs a class
3235
def new_visit_versionmodified(self, node):
3336
self.body.append(self.starttag(node, 'p', CLASS=node['type']))
@@ -88,8 +91,6 @@ def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
8891

8992
# Support for marking up implementation details
9093

91-
from sphinx.util.compat import Directive
92-
9394
class ImplementationDetail(Directive):
9495

9596
has_content = True
@@ -142,10 +143,6 @@ def run(self):
142143

143144
# Support for documenting version of removal in deprecations
144145

145-
from sphinx.locale import versionlabels
146-
from sphinx.util.compat import Directive
147-
148-
149146
class DeprecatedRemoved(Directive):
150147
has_content = True
151148
required_arguments = 2
@@ -171,23 +168,26 @@ def run(self):
171168
messages = []
172169
if self.content:
173170
self.state.nested_parse(self.content, self.content_offset, node)
174-
if len(node):
175171
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
176172
content = nodes.inline(node[0].rawsource, translatable=True)
177173
content.source = node[0].source
178174
content.line = node[0].line
179175
content += node[0].children
180176
node[0].replace_self(nodes.paragraph('', '', content))
181-
node[0].insert(0, nodes.inline('', '%s: ' % text,
182-
classes=['versionmodified']))
183-
else:
177+
if not SPHINX11:
178+
node[0].insert(0, nodes.inline('', '%s: ' % text,
179+
classes=['versionmodified']))
180+
elif not SPHINX11:
184181
para = nodes.paragraph('', '',
185182
nodes.inline('', '%s.' % text, classes=['versionmodified']))
186183
node.append(para)
187184
env = self.state.document.settings.env
188185
env.note_versionchange('deprecated', version[0], node, self.lineno)
189186
return [node] + messages
190187

188+
# for Sphinx < 1.2
189+
versionlabels['deprecated-removed'] = DeprecatedRemoved._label
190+
191191

192192
# Support for including Misc/NEWS
193193

0 commit comments

Comments
 (0)