diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-12-30 10:04:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-30 10:04:22 +0900 |
commit | 40186077d7e05ff6aa61d290b3bc1a844bdd8667 (patch) | |
tree | 96a6c4ac7d07f8e68d9bf840c46299cbf76d834b /sphinx/application.py | |
parent | a260a9ea15214db1ffed6071f25e77c9ebd9f454 (diff) | |
parent | d7aa98aed7d5e5f361d76768c1abf12f912c3609 (diff) | |
download | sphinx-git-40186077d7e05ff6aa61d290b3bc1a844bdd8667.tar.gz |
Merge pull request #4358 from tk0miya/ensure_parallelism
Ensure parallelism
Diffstat (limited to 'sphinx/application.py')
-rw-r--r-- | sphinx/application.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index b6fd7feef..2a084ff0c 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -19,7 +19,7 @@ import posixpath from os import path from collections import deque -from six import iteritems +from six import iteritems, itervalues from six.moves import cStringIO from docutils import nodes @@ -673,6 +673,34 @@ class Sphinx(object): logger.debug('[app] adding HTML theme: %r, %r', name, theme_path) self.html_themes[name] = theme_path + # ---- other methods ------------------------------------------------- + def is_parallel_allowed(self, typ): + # type: (unicode) -> bool + """Check parallel processing is allowed or not. + + ``typ`` is a type of processing; ``'read'`` or ``'write'``. + """ + if typ == 'read': + attrname = 'parallel_read_safe' + elif typ == 'write': + attrname = 'parallel_write_safe' + else: + raise ValueError('parallel type %s is not supported' % typ) + + for ext in itervalues(self.extensions): + allowed = getattr(ext, attrname, None) + if allowed is None: + logger.warning(__("the %s extension does not declare if it is safe " + "for parallel %sing, assuming it isn't - please " + "ask the extension author to check and make it " + "explicit"), ext.name, typ) + logger.warning('doing serial %s', typ) + return False + elif not allowed: + return False + + return True + class TemplateBridge(object): """ |