Merge pull request #3671 from tk0miya/3669_gettext_raises_ValueError

3669 gettext raises value error
This commit is contained in:
Takeshi KOMIYA 2017-04-27 01:10:11 +09:00 committed by GitHub
commit 84213da197
2 changed files with 13 additions and 8 deletions

View File

@ -16,6 +16,7 @@ Bugs fixed
----------
* #3661: sphinx-build crashes on parallel build
* #3669: gettext builder fails with "ValueError: substring not found"
Testing
--------

View File

@ -194,6 +194,7 @@ ltz = LocalTimeZone()
def should_write(filepath, new_content):
if not path.exists(filepath):
return True
try:
with open(filepath, 'r', encoding='utf-8') as oldpot: # type: ignore
old_content = oldpot.read()
old_header_index = old_content.index('"POT-Creation-Date:')
@ -202,6 +203,9 @@ def should_write(filepath, new_content):
new_body_index = new_content.index('"PO-Revision-Date:')
return ((old_content[:old_header_index] != new_content[:new_header_index]) or
(new_content[new_body_index:] != old_content[old_body_index:]))
except ValueError:
pass
return True