summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-03-17 05:54:05 (GMT)
committerLarry Hastings <larry@hastings.org>2014-03-17 05:54:05 (GMT)
commit3c5c56f3c068bc13daea2275b951113b43a91e85 (patch)
tree1395bfb10902b7087a4ca1551f4bdb271b55ed43 /Doc/tools
parente41b73caca2b543422f423a2ac07c29de834f44d (diff)
parent2221f666eba4a6f46f2095a801bc3e4bdbdb97d2 (diff)
downloadcpython-3c5c56f3c068bc13daea2275b951113b43a91e85.zip
cpython-3c5c56f3c068bc13daea2275b951113b43a91e85.tar.gz
cpython-3c5c56f3c068bc13daea2275b951113b43a91e85.tar.bz2
Merged default into 3.4 branch. 3.4 branch is now effectively 3.4.1rc1.
Diffstat (limited to 'Doc/tools')
-rw-r--r--Doc/tools/sphinx-build.py28
-rw-r--r--Doc/tools/sphinxext/pyspecific.py22
2 files changed, 11 insertions, 39 deletions
diff --git a/Doc/tools/sphinx-build.py b/Doc/tools/sphinx-build.py
deleted file mode 100644
index a446dfa..0000000
--- a/Doc/tools/sphinx-build.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
- Sphinx - Python documentation toolchain
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- :copyright: 2007-2010 by Georg Brandl.
- :license: Python license.
-"""
-
-import sys
-import warnings
-
-# Get rid of UserWarnings reported by pkg_resources.
-warnings.filterwarnings('ignore', category=UserWarning, module='jinja2')
-
-if __name__ == '__main__':
-
- if sys.version_info[:3] < (2, 4, 0) or sys.version_info[:3] > (3, 0, 0):
- sys.stderr.write("""\
-Error: Sphinx needs to be executed with Python 2.4 or newer (not 3.0 though).
-(If you run this from the Makefile, you can set the PYTHON variable
-to the path of an alternative interpreter executable, e.g.,
-``make html PYTHON=python2.5``).
-""")
- sys.exit(1)
-
- from sphinx import main
- sys.exit(main(sys.argv))
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py
index 4e41446..31d8c06 100644
--- a/Doc/tools/sphinxext/pyspecific.py
+++ b/Doc/tools/sphinxext/pyspecific.py
@@ -16,6 +16,7 @@ from docutils import nodes, utils
import sphinx
from sphinx.util.nodes import split_explicit_title
+from sphinx.util.compat import Directive
from sphinx.writers.html import HTMLTranslator
from sphinx.writers.latex import LaTeXTranslator
from sphinx.locale import versionlabels
@@ -27,7 +28,9 @@ Body.enum.converters['loweralpha'] = \
Body.enum.converters['lowerroman'] = \
Body.enum.converters['upperroman'] = lambda x: None
-if sphinx.__version__[:3] < '1.2':
+SPHINX11 = sphinx.__version__[:3] < '1.2'
+
+if SPHINX11:
# monkey-patch HTML translator to give versionmodified paragraphs a class
def new_visit_versionmodified(self, node):
self.body.append(self.starttag(node, 'p', CLASS=node['type']))
@@ -88,8 +91,6 @@ def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
# Support for marking up implementation details
-from sphinx.util.compat import Directive
-
class ImplementationDetail(Directive):
has_content = True
@@ -142,10 +143,6 @@ class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
# Support for documenting version of removal in deprecations
-from sphinx.locale import versionlabels
-from sphinx.util.compat import Directive
-
-
class DeprecatedRemoved(Directive):
has_content = True
required_arguments = 2
@@ -171,16 +168,16 @@ class DeprecatedRemoved(Directive):
messages = []
if self.content:
self.state.nested_parse(self.content, self.content_offset, node)
- if len(node):
if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
content = nodes.inline(node[0].rawsource, translatable=True)
content.source = node[0].source
content.line = node[0].line
content += node[0].children
node[0].replace_self(nodes.paragraph('', '', content))
- node[0].insert(0, nodes.inline('', '%s: ' % text,
- classes=['versionmodified']))
- else:
+ if not SPHINX11:
+ node[0].insert(0, nodes.inline('', '%s: ' % text,
+ classes=['versionmodified']))
+ elif not SPHINX11:
para = nodes.paragraph('', '',
nodes.inline('', '%s.' % text, classes=['versionmodified']))
node.append(para)
@@ -188,6 +185,9 @@ class DeprecatedRemoved(Directive):
env.note_versionchange('deprecated', version[0], node, self.lineno)
return [node] + messages
+# for Sphinx < 1.2
+versionlabels['deprecated-removed'] = DeprecatedRemoved._label
+
# Support for including Misc/NEWS