diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-02-07 13:56:17 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-02-08 12:44:15 +0900 |
| commit | afbd27f9969680f72a52976e8afd2b1f25af1faa (patch) | |
| tree | 21483d17133ed8301ec02cf00ba28ce95c367aab | |
| parent | 51a0f709b5f4bfc5618b1249ceefafcade410a1f (diff) | |
| download | sphinx-git-afbd27f9969680f72a52976e8afd2b1f25af1faa.tar.gz | |
Fix i18n: message catalogs are not compiled when specific build (refs: #4560)
sphinx-build skips message catalog builds if specific filename are given
as arguments.
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | sphinx/builders/__init__.py | 11 | ||||
| -rw-r--r-- | tests/test_catalogs.py | 2 |
3 files changed, 10 insertions, 5 deletions
@@ -20,6 +20,8 @@ Bugs fixed * #4531: autosummary: methods are not treated as attributes * #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved * #4539: autodoc emits warnings for partialmethods +* i18n: message catalogs are not compiled if specific filenames are given for + ``sphinx-build`` as arguments (refs: #4560) Testing -------- diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 324df8664..5c4714e8f 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -16,7 +16,7 @@ from docutils import nodes from sphinx.deprecation import RemovedInSphinx20Warning from sphinx.environment.adapters.asset import ImageAdapter -from sphinx.util import i18n, path_stabilize, logging, status_iterator +from sphinx.util import i18n, logging, status_iterator from sphinx.util.console import bold # type: ignore from sphinx.util.i18n import find_catalog from sphinx.util.osutil import SEP, ensuredir, relative_uri @@ -255,11 +255,14 @@ class Builder(object): # type: (List[unicode]) -> None def to_domain(fpath): # type: (unicode) -> unicode - docname, _ = path.splitext(path_stabilize(fpath)) - dom = find_catalog(docname, self.config.gettext_compact) - return dom + docname = self.env.path2doc(path.abspath(fpath)) + if docname: + return find_catalog(docname, self.config.gettext_compact) + else: + return None specified_domains = set(map(to_domain, specified_files)) + specified_domains.discard(None) catalogs = i18n.find_catalog_source_files( [path.join(self.srcdir, x) for x in self.config.locale_dirs], self.config.language, diff --git a/tests/test_catalogs.py b/tests/test_catalogs.py index 4bfbb18a3..79e8d6b95 100644 --- a/tests/test_catalogs.py +++ b/tests/test_catalogs.py @@ -65,7 +65,7 @@ def test_compile_specific_catalogs(app, status, warning): return set(find_files(catalog_dir, '.mo')) actual_on_boot = get_actual() # sphinx.mo might be included - app.builder.compile_specific_catalogs(['admonitions']) + app.builder.compile_specific_catalogs([app.srcdir / 'admonitions.txt']) actual = get_actual() - actual_on_boot assert actual == set(['admonitions.mo']) |
