mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Drop docutils-0.7, 0.8 and 0.9 support
This commit is contained in:
parent
f7cb510ebd
commit
2050285ebf
@ -135,8 +135,7 @@ Note that a direct PDF builder using ReportLab is available in `rst2pdf
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This builder requires the docutils manual page writer, which is only
|
This builder requires the docutils manual page writer.
|
||||||
available as of docutils 0.6.
|
|
||||||
|
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ Prerequisites
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
Sphinx needs at least **Python 2.6** or **Python 3.2** to run, as well as the
|
Sphinx needs at least **Python 2.6** or **Python 3.2** to run, as well as the
|
||||||
docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.7
|
docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.10
|
||||||
or some (not broken) SVN trunk snapshot. If you like to have source code
|
or some (not broken) SVN trunk snapshot. If you like to have source code
|
||||||
highlighting support, you must also install the Pygments_ library.
|
highlighting support, you must also install the Pygments_ library.
|
||||||
|
|
||||||
|
5
setup.py
5
setup.py
@ -48,10 +48,7 @@ if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 2):
|
|||||||
print('ERROR: Sphinx requires at least Python 2.6 or 3.2 to run.')
|
print('ERROR: Sphinx requires at least Python 2.6 or 3.2 to run.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
requires = ['Pygments>=1.2', 'docutils>=0.7']
|
requires = ['Pygments>=1.2', 'docutils>=0.10']
|
||||||
|
|
||||||
if sys.version_info[:3] >= (3, 3, 0):
|
|
||||||
requires[1] = 'docutils>=0.10'
|
|
||||||
|
|
||||||
if (3, 0) <= sys.version_info < (3, 3):
|
if (3, 0) <= sys.version_info < (3, 3):
|
||||||
requires.append('Jinja2>=2.3,<2.7')
|
requires.append('Jinja2>=2.3,<2.7')
|
||||||
|
@ -71,11 +71,11 @@ def main(argv=sys.argv):
|
|||||||
sys.stderr.write(hint)
|
sys.stderr.write(hint)
|
||||||
return 1
|
return 1
|
||||||
raise
|
raise
|
||||||
if sys.version_info[:3] >= (3, 3, 0):
|
|
||||||
from sphinx.util.compat import docutils_version
|
from sphinx.util.compat import docutils_version
|
||||||
if docutils_version < (0, 10):
|
if docutils_version < (0, 10):
|
||||||
sys.stderr.write('Error: Sphinx requires at least '
|
sys.stderr.write('Error: Sphinx requires at least Docutils 0.10 to '
|
||||||
'Docutils 0.10 for Python 3.3 and above.\n')
|
'run.\n')
|
||||||
return 1
|
return 1
|
||||||
return cmdline.main(argv)
|
return cmdline.main(argv)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from sphinx.builders import Builder
|
|||||||
from sphinx.environment import NoUri
|
from sphinx.environment import NoUri
|
||||||
from sphinx.util.nodes import inline_all_toctrees
|
from sphinx.util.nodes import inline_all_toctrees
|
||||||
from sphinx.util.console import bold, darkgreen
|
from sphinx.util.console import bold, darkgreen
|
||||||
from sphinx.writers.manpage import ManualPageWriter, has_manpage_writer
|
from sphinx.writers.manpage import ManualPageWriter
|
||||||
|
|
||||||
|
|
||||||
class ManualPageBuilder(Builder):
|
class ManualPageBuilder(Builder):
|
||||||
@ -32,9 +32,6 @@ class ManualPageBuilder(Builder):
|
|||||||
supported_image_types = []
|
supported_image_types = []
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if not has_manpage_writer:
|
|
||||||
raise SphinxError('The docutils manual page writer can\'t be '
|
|
||||||
'found; it is only available as of docutils 0.6.')
|
|
||||||
if not self.config.man_pages:
|
if not self.config.man_pages:
|
||||||
self.warn('no "man_pages" config value found; no manual pages '
|
self.warn('no "man_pages" config value found; no manual pages '
|
||||||
'will be written')
|
'will be written')
|
||||||
|
@ -142,9 +142,6 @@ class CustomLocaleReporter(object):
|
|||||||
self.source, self.line = source, line
|
self.source, self.line = source, line
|
||||||
|
|
||||||
def set_reporter(self, document):
|
def set_reporter(self, document):
|
||||||
if docutils_version < (0, 9):
|
|
||||||
document.reporter.locator = self.get_source_and_line
|
|
||||||
else:
|
|
||||||
document.reporter.get_source_and_line = self.get_source_and_line
|
document.reporter.get_source_and_line = self.get_source_and_line
|
||||||
|
|
||||||
def get_source_and_line(self, lineno=None):
|
def get_source_and_line(self, lineno=None):
|
||||||
|
@ -223,11 +223,6 @@ def set_source_info(directive, node):
|
|||||||
directive.state_machine.get_source_and_line(directive.lineno)
|
directive.state_machine.get_source_and_line(directive.lineno)
|
||||||
|
|
||||||
def set_role_source_info(inliner, lineno, node):
|
def set_role_source_info(inliner, lineno, node):
|
||||||
try:
|
|
||||||
node.source, node.line = \
|
|
||||||
inliner.reporter.locator(lineno)
|
|
||||||
except AttributeError:
|
|
||||||
# docutils 0.9+
|
|
||||||
node.source, node.line = inliner.reporter.get_source_and_line(lineno)
|
node.source, node.line = inliner.reporter.get_source_and_line(lineno)
|
||||||
|
|
||||||
# monkey-patch Element.copy to copy the rawsource
|
# monkey-patch Element.copy to copy the rawsource
|
||||||
@ -236,17 +231,3 @@ def _new_copy(self):
|
|||||||
return self.__class__(self.rawsource, **self.attributes)
|
return self.__class__(self.rawsource, **self.attributes)
|
||||||
|
|
||||||
nodes.Element.copy = _new_copy
|
nodes.Element.copy = _new_copy
|
||||||
|
|
||||||
# monkey-patch Element.__repr__ to return str if it returns unicode.
|
|
||||||
# Was fixed in docutils since 0.10. See sf.net/p/docutils/bugs/218/.
|
|
||||||
|
|
||||||
if sys.version_info < (3,):
|
|
||||||
_element_repr_orig = nodes.Element.__repr__
|
|
||||||
|
|
||||||
def _new_repr(self):
|
|
||||||
s = _element_repr_orig(self)
|
|
||||||
if isinstance(s, unicode):
|
|
||||||
return s.encode('utf-8')
|
|
||||||
return s
|
|
||||||
|
|
||||||
nodes.Element.__repr__ = _new_repr
|
|
||||||
|
@ -10,14 +10,11 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
try:
|
from docutils.writers.manpage import (
|
||||||
from docutils.writers.manpage import MACRO_DEF, Writer, \
|
MACRO_DEF,
|
||||||
|
Writer,
|
||||||
Translator as BaseTranslator
|
Translator as BaseTranslator
|
||||||
has_manpage_writer = True
|
)
|
||||||
except ImportError:
|
|
||||||
# define the classes in any case, sphinx.application needs it
|
|
||||||
Writer = BaseTranslator = object
|
|
||||||
has_manpage_writer = False
|
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.locale import admonitionlabels, _
|
from sphinx.locale import admonitionlabels, _
|
||||||
|
22
tox.ini
22
tox.ini
@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist=py26,py27,py32,py33,pypy,du11,du10,du09,du08,du07
|
envlist=py26,py27,py32,py33,pypy,du11,du10
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps=
|
deps=
|
||||||
@ -12,31 +12,11 @@ commands=
|
|||||||
{envpython} tests/run.py {posargs}
|
{envpython} tests/run.py {posargs}
|
||||||
sphinx-build -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
sphinx-build -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
||||||
|
|
||||||
[testenv:py33]
|
|
||||||
deps=
|
|
||||||
docutils>=0.10.0
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
deps=
|
deps=
|
||||||
simplejson
|
simplejson
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:du07]
|
|
||||||
deps=
|
|
||||||
docutils==0.7
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:du08]
|
|
||||||
deps=
|
|
||||||
docutils==0.8.1
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:du09]
|
|
||||||
deps=
|
|
||||||
docutils==0.9.1
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:du10]
|
[testenv:du10]
|
||||||
deps=
|
deps=
|
||||||
docutils==0.10
|
docutils==0.10
|
||||||
|
Loading…
Reference in New Issue
Block a user