Bug 1223385 - use in-tree compare-locales in mozharness, r=rail

This commit is contained in:
Axel Hecht 2016-01-08 16:21:24 +01:00
parent aab6213eca
commit 5444e01985

View File

@ -35,10 +35,12 @@ class LocalesMixin(ChunkingMixin):
python = self.query_exe('python2.7')
return [python, 'mach']
def _mach(self, target, env, halt_on_failure=True, output_parser=None):
def _mach(self, target, env, error_list=None, halt_on_failure=True,
output_parser=None):
dirs = self.query_abs_dirs()
mach = self._get_mach_executable()
return self.run_command(mach + target,
error_list=error_list,
halt_on_failure=True,
env=env,
cwd=dirs['abs_mozilla_dir'],
@ -154,20 +156,13 @@ class LocalesMixin(ChunkingMixin):
def run_compare_locales(self, locale, halt_on_failure=False):
dirs = self.query_abs_dirs()
compare_locales_script = os.path.join(dirs['abs_compare_locales_dir'],
'scripts', 'compare-locales')
env = self.query_env(partial_env={'PYTHONPATH':
os.path.join(dirs['abs_compare_locales_dir'],
'lib')})
env = self.query_bootstrap_env()
compare_locales_error_list = list(PythonErrorList)
self.rmtree(dirs['abs_merge_dir'])
self.mkdir_p(dirs['abs_merge_dir'])
command = "python %s -m %s l10n.ini %s %s" % (compare_locales_script,
dirs['abs_merge_dir'], dirs['abs_l10n_dir'], locale)
command = ['compare-locales',
'--merge-dir', dirs['abs_merge_dir'], locale]
self.info("*** BEGIN compare-locales %s" % locale)
status = self.run_command(command, error_list=compare_locales_error_list,
cwd=dirs['abs_locales_src_dir'], env=env,
halt_on_failure=halt_on_failure)
status = self._mach(command, env, error_list=compare_locales_error_list,
halt_on_failure=halt_on_failure)
self.info("*** END compare-locales %s" % locale)
return status
@ -200,8 +195,6 @@ class LocalesMixin(ChunkingMixin):
'merged')
dirs['abs_locales_dir'] = os.path.join(dirs['abs_objdir'],
c['locales_dir'])
dirs['abs_compare_locales_dir'] = os.path.join(dirs['abs_work_dir'],
'compare-locales')
for key in dirs.keys():
if key not in abs_dirs:
abs_dirs[key] = dirs[key]