diff options
| author | Georg Brandl <georg@python.org> | 2010-01-17 18:29:16 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-01-17 18:29:16 +0100 |
| commit | 50cb36da7d8d6436f40aacd63709b58e4459220a (patch) | |
| tree | 59a06b108522d2452fe084a2c80b106bdce86fe3 /sphinx/application.py | |
| parent | 8068e49908a76448e405273dff83ceb670435e77 (diff) | |
| parent | 295e4e7ee85020cb7f4ed67ddc586b3d08b3d195 (diff) | |
| download | sphinx-50cb36da7d8d6436f40aacd63709b58e4459220a.tar.gz | |
merge with trunk
Diffstat (limited to 'sphinx/application.py')
| -rw-r--r-- | sphinx/application.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 37117692..58570a14 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -25,7 +25,8 @@ import sphinx from sphinx import package_dir, locale from sphinx.roles import XRefRole from sphinx.config import Config -from sphinx.errors import SphinxError, SphinxWarning, ExtensionError +from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \ + VersionRequirementError from sphinx.domains import ObjType, all_domains from sphinx.domains.std import GenericObject, Target, StandardDomain from sphinx.builders import BUILTIN_BUILDERS @@ -111,6 +112,13 @@ class Sphinx(object): # now that we know all config values, collect them from conf.py self.config.init_values() + # check the Sphinx version if requested + if self.config.needs_sphinx and \ + self.config.needs_sphinx > sphinx.__version__[:3]: + raise VersionRequirementError( + 'This project needs at least Sphinx v%s and therefore cannot ' + 'be built with this version.' % self.config.needs_sphinx) + # set up translation infrastructure self._init_i18n() # set up the build environment @@ -232,9 +240,21 @@ class Sphinx(object): self.warn('extension %r has no setup() function; is it really ' 'a Sphinx extension module?' % extension) else: - mod.setup(self) + try: + mod.setup(self) + except VersionRequirementError, err: + # add the extension name to the version required + raise VersionRequirementError( + 'The %s extension used by this project needs at least ' + 'Sphinx v%s; it therefore cannot be built with this ' + 'version.' % (extension, err)) self._extensions[extension] = mod + def require_sphinx(self, version): + # check the Sphinx version if requested + if version > sphinx.__version__[:3]: + raise VersionRequirementError(version) + def import_object(self, objname, source=None): """Import an object from a 'module.name' string.""" try: |
