mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix: #2469: Ignore updates of catalog files for gettext builder. Thanks to Hiroshi Ohkubo.
This commit is contained in:
parent
d0fe6ba215
commit
5fc8d3db91
2
CHANGES
2
CHANGES
@ -21,6 +21,8 @@ Bugs fixed
|
||||
* #3220: KeyError when having a duplicate citation
|
||||
* #3200: LaTeX: xref inside desc_name not allowed
|
||||
* #3228: ``build_sphinx`` command crashes when missing dependency
|
||||
* #2469: Ignore updates of catalog files for gettext builder. Thanks to
|
||||
Hiroshi Ohkubo.
|
||||
|
||||
|
||||
Release 1.5 (released Dec 5, 2016)
|
||||
|
@ -281,7 +281,7 @@ class Sphinx(object):
|
||||
if freshenv:
|
||||
self.env = BuildEnvironment(self.srcdir, self.doctreedir, self.config)
|
||||
self.env.set_warnfunc(self.warn)
|
||||
self.env.find_files(self.config)
|
||||
self.env.find_files(self.config, self.buildername)
|
||||
for domain in self.domains.keys():
|
||||
self.env.domains[domain] = self.domains[domain](self.env)
|
||||
else:
|
||||
|
@ -379,7 +379,7 @@ class BuildEnvironment(object):
|
||||
enc_rel_fn = rel_fn.encode(sys.getfilesystemencoding())
|
||||
return rel_fn, path.abspath(path.join(self.srcdir, enc_rel_fn))
|
||||
|
||||
def find_files(self, config):
|
||||
def find_files(self, config, buildername=None):
|
||||
"""Find all source files in the source dir and put them in
|
||||
self.found_docs.
|
||||
"""
|
||||
@ -397,6 +397,13 @@ class BuildEnvironment(object):
|
||||
else:
|
||||
self.warn(docname, "document not readable. Ignored.")
|
||||
|
||||
# Current implementation is applying translated messages in the reading
|
||||
# phase.Therefore, in order to apply the updated message catalog, it is
|
||||
# necessary to re-process from the reading phase. Here, if dependency
|
||||
# is set for the doc source and the mo file, it is processed again from
|
||||
# the reading phase when mo is updated. In the future, we would like to
|
||||
# move i18n process into the writing phase, and remove these lines.
|
||||
if buildername != 'gettext':
|
||||
# add catalog mo file dependency
|
||||
for docname in self.found_docs:
|
||||
catalog_files = find_catalog_files(
|
||||
@ -488,7 +495,7 @@ class BuildEnvironment(object):
|
||||
# the source and doctree directories may have been relocated
|
||||
self.srcdir = srcdir
|
||||
self.doctreedir = doctreedir
|
||||
self.find_files(config)
|
||||
self.find_files(config, app.buildername)
|
||||
self.config = config
|
||||
|
||||
# this cache also needs to be updated every time
|
||||
|
@ -367,6 +367,15 @@ def test_gettext_builder(app, status, warning):
|
||||
for expect_msg in [m for m in expect if m.id]:
|
||||
yield assert_in, expect_msg.id, [m.id for m in actual if m.id]
|
||||
|
||||
# --- don't rebuild by .mo mtime
|
||||
app.builder.build_update()
|
||||
updated = app.env.update(app.config, app.srcdir, app.doctreedir, app)
|
||||
yield assert_equal, len(updated), 0
|
||||
|
||||
(app.srcdir / 'xx' / 'LC_MESSAGES' / 'bom.mo').utime(None)
|
||||
updated = app.env.update(app.config, app.srcdir, app.doctreedir, app)
|
||||
yield assert_equal, len(updated), 0
|
||||
|
||||
|
||||
@gen_with_intl_app('html', freshenv=True)
|
||||
def test_html_builder(app, status, warning):
|
||||
|
Loading…
Reference in New Issue
Block a user