mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2436: Sphinx does not check version by :confval:needs_sphinx
if loading extensions failed
This commit is contained in:
parent
f15bdce1db
commit
febfd6829c
1
CHANGES
1
CHANGES
@ -12,6 +12,7 @@ Bugs fixed
|
||||
* #2370: the equations are slightly misaligned in LaTeX writer
|
||||
* #1817, #2077: suppress pep8 warnings on conf.py generated by sphinx-quickstart
|
||||
* #2407: building docs crash if document includes large data image URIs
|
||||
* #2436: Sphinx does not check version by :confval:`needs_sphinx` if loading extensions failed
|
||||
|
||||
|
||||
Release 1.4.1 (released Apr 12, 2016)
|
||||
|
@ -133,6 +133,13 @@ class Sphinx(object):
|
||||
self.config.check_unicode(self.warn)
|
||||
# defer checking types until i18n has been initialized
|
||||
|
||||
# check the Sphinx version if requested
|
||||
needs_sphinx = self.config.get_needs_sphinx()
|
||||
if needs_sphinx and needs_sphinx > sphinx.__display_version__:
|
||||
raise VersionRequirementError(
|
||||
'This project needs at least Sphinx v%s and therefore cannot '
|
||||
'be built with this version.' % needs_sphinx)
|
||||
|
||||
# set confdir to srcdir if -C given (!= no confdir); a few pieces
|
||||
# of code expect a confdir to be set
|
||||
if self.confdir is None:
|
||||
@ -163,13 +170,6 @@ class Sphinx(object):
|
||||
# now that we know all config values, collect them from conf.py
|
||||
self.config.init_values(self.warn)
|
||||
|
||||
# check the Sphinx version if requested
|
||||
if self.config.needs_sphinx and \
|
||||
self.config.needs_sphinx > sphinx.__display_version__:
|
||||
raise VersionRequirementError(
|
||||
'This project needs at least Sphinx v%s and therefore cannot '
|
||||
'be built with this version.' % self.config.needs_sphinx)
|
||||
|
||||
# check extension versions if requested
|
||||
if self.config.needs_extensions:
|
||||
for extname, needs_ver in self.config.needs_extensions.items():
|
||||
|
@ -338,6 +338,10 @@ class Config(object):
|
||||
'characters; this can lead to Unicode errors occurring. '
|
||||
'Please use Unicode strings, e.g. %r.' % (name, u'Content'))
|
||||
|
||||
def get_needs_sphinx(self):
|
||||
"""Obtain the value of ``needs_sphinx``"""
|
||||
return self.overrides.get('needs_sphinx') or self._raw_config.get('needs_sphinx')
|
||||
|
||||
def init_values(self, warn):
|
||||
config = self._raw_config
|
||||
for valname, value in iteritems(self.overrides):
|
||||
|
Loading…
Reference in New Issue
Block a user