mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Stop handling package issues from 'sphinx-build'
There were a number of package error handlers run as part of the 'sphinx-build' command/executable: - Unsupported Python version (it should be 2.7 or 3.4+) - Missing packages (missing docutils, jinja2, and roman, which is part of docutils, packages) - Out-of-date packages (docutils) This code is mostly unchanged since Sphinx was first released. Python, and in particular Python's packaging options, have come a long way since then. Today, all of the above checks are provided by setuptools and the 'setup.py' script, meaning we should never actually get to the point of triggering any of these checks. This is further reinforced by the fact that none of the other executables carry out these checks: either this is a bug that no one has reported in ~8 years or, more likely, the checks are useless and we don't need them anywhere. In all, we can happily remove these checks, greatly simplify a piece of code that's otherwise rarely touched, and trust that setuptools is up to the job it's designed for. Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
parent
1892fc18b9
commit
d736efbdab
@ -74,42 +74,7 @@ def main(argv=sys.argv[1:]):
|
||||
def build_main(argv=sys.argv[1:]):
|
||||
# type: (List[str]) -> int
|
||||
"""Sphinx build "main" command-line entry."""
|
||||
if (sys.version_info[:3] < (2, 7, 0) or
|
||||
(3, 0, 0) <= sys.version_info[:3] < (3, 4, 0)):
|
||||
sys.stderr.write('Error: Sphinx requires at least Python 2.7 or 3.4 to run.\n')
|
||||
return 1
|
||||
try:
|
||||
from sphinx import cmdline
|
||||
except ImportError:
|
||||
err = sys.exc_info()[1]
|
||||
errstr = str(err)
|
||||
if errstr.lower().startswith('no module named'):
|
||||
whichmod = errstr[16:]
|
||||
hint = ''
|
||||
if whichmod.startswith('docutils'):
|
||||
whichmod = 'Docutils library'
|
||||
elif whichmod.startswith('jinja'):
|
||||
whichmod = 'Jinja2 library'
|
||||
elif whichmod == 'roman':
|
||||
whichmod = 'roman module (which is distributed with Docutils)'
|
||||
hint = ('This can happen if you upgraded docutils using\n'
|
||||
'easy_install without uninstalling the old version'
|
||||
'first.\n')
|
||||
else:
|
||||
whichmod += ' module'
|
||||
sys.stderr.write('Error: The %s cannot be found. '
|
||||
'Did you install Sphinx and its dependencies '
|
||||
'correctly?\n' % whichmod)
|
||||
if hint:
|
||||
sys.stderr.write(hint)
|
||||
return 1
|
||||
raise
|
||||
|
||||
import sphinx.util.docutils
|
||||
if sphinx.util.docutils.__version_info__ < (0, 10):
|
||||
sys.stderr.write('Error: Sphinx requires at least Docutils 0.10 to '
|
||||
'run.\n')
|
||||
return 1
|
||||
from sphinx import cmdline
|
||||
return cmdline.main(argv) # type: ignore
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user