From: John Mandereau Date: Sat, 22 Nov 2008 19:19:53 +0000 (+0100) Subject: Docs: fix translations checking X-Git-Tag: release/2.11.65-1~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6dc71de26828aecb98189ed3929ebee8d5504e7b;p=lilypond.git Docs: fix translations checking --- diff --git a/buildscripts/buildlib.py b/buildscripts/buildlib.py index 11dbf96a16..cd99586ff8 100644 --- a/buildscripts/buildlib.py +++ b/buildscripts/buildlib.py @@ -2,6 +2,7 @@ import subprocess import re +import sys verbose = False @@ -18,13 +19,13 @@ def read_pipe (command): error = code + ' ' + error return (output, error) -revision_re = re.compile ('GIT [Cc]ommittish: ([a-f0-9]+)') +revision_re = re.compile ('GIT [Cc]ommittish:\s+([a-f0-9]+)') vc_diff_cmd = 'git diff %(color_flag)s %(revision)s HEAD -- %(original)s | cat' -def check_translated_doc (original, translated_contents, color=False): +def check_translated_doc (original, translated_file, translated_contents, color=False): m = revision_re.search (translated_contents) if not m: - sys.stderr.write ('error: ' + translated + \ + sys.stderr.write ('error: ' + translated_file + \ ": no 'GIT committish: ' found.\nPlease check " + \ 'the whole file against the original in English, then ' + \ 'fill in HEAD committish in the header.\n') diff --git a/buildscripts/check_translation.py b/buildscripts/check_translation.py index 4f6ef6a629..090b1fbe8a 100755 --- a/buildscripts/check_translation.py +++ b/buildscripts/check_translation.py @@ -36,7 +36,11 @@ def do_file (file_name, lang_codes, buildlib): original = dir_lang (file_name, '', lang_dir_index) translated_contents = open (file_name).read () - (diff_string, error) = buildlib.check_translated_doc (original, translated_contents, color=use_colors and not update_mode) + (diff_string, error) \ + = buildlib.check_translated_doc (original, + file_name, + translated_contents, + color=use_colors and not update_mode) if error: sys.stderr.write ('warning: %s: %s' % (file_name, error)) diff --git a/buildscripts/translations-status.py b/buildscripts/translations-status.py index 4180ea8672..c93199354f 100755 --- a/buildscripts/translations-status.py +++ b/buildscripts/translations-status.py @@ -247,7 +247,7 @@ class TranslatedTelyDocument (TelyDocument): ## calculate how much the file is outdated (diff_string, error) = \ - buildlib.check_translated_doc (masterdocument.filename, self.contents) + buildlib.check_translated_doc (masterdocument.filename, self.filename, self.contents) if error: sys.stderr.write ('warning: %s: %s' % (self.filename, error)) self.uptodate_percentage = None