bug 1237678, refactor mach helper into LocalesMixin, r?rail draft
authorAxel Hecht <axel@pike.org>
Fri, 08 Jan 2016 15:09:57 +0100
changeset 320096 007dfdc9262357ef470431a9e4adf78dd3617c24
parent 319654 e0bcd16e1d4b99ba3e542149d0d41e0f60c54b5c
child 320097 2ea75cf89c6064c75c55dd9390ce4940641907f6
push id9132
push useraxel@mozilla.com
push dateFri, 08 Jan 2016 16:06:36 +0000
reviewersrail
bugs1237678
milestone46.0a1
bug 1237678, refactor mach helper into LocalesMixin, r?rail
testing/mozharness/mozharness/mozilla/l10n/locales.py
testing/mozharness/scripts/desktop_l10n.py
--- a/testing/mozharness/mozharness/mozilla/l10n/locales.py
+++ b/testing/mozharness/mozharness/mozilla/l10n/locales.py
@@ -26,16 +26,29 @@ class LocalesMixin(ChunkingMixin):
         This breaks super().__init__() for children.
         However, this is needed to override the query_abs_dirs()
         """
         self.abs_dirs = None
         self.locales = None
         self.gecko_locale_revisions = None
         self.l10n_revisions = {}
 
+    def _get_mach_executable(self):
+        python = self.query_exe('python2.7')
+        return [python, 'mach']
+
+    def _mach(self, target, env, halt_on_failure=True, output_parser=None):
+        dirs = self.query_abs_dirs()
+        mach = self._get_mach_executable()
+        return self.run_command(mach + target,
+                                halt_on_failure=True,
+                                env=env,
+                                cwd=dirs['abs_mozilla_dir'],
+                                output_parser=None)
+
     def query_locales(self):
         if self.locales is not None:
             return self.locales
         c = self.config
         ignore_locales = c.get("ignore_locales", [])
         additional_locales = c.get("additional_locales", [])
         # List of locales can be set by using different methods in the
         # following order:
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -601,35 +601,22 @@ class DesktopSingleLocale(LocalesMixin, 
         config = self.config
         dirs = self.query_abs_dirs()
         mozconfig = config['mozconfig']
         src = os.path.join(dirs['abs_work_dir'], mozconfig)
         dst = os.path.join(dirs['abs_mozilla_dir'], '.mozconfig')
         self.copyfile(src, dst)
         self.read_from_file(dst, verbose=True)
 
-    def _mach(self, target, env, halt_on_failure=True, output_parser=None):
-        dirs = self.query_abs_dirs()
-        mach = self._get_mach_executable()
-        return self.run_command(mach + target,
-                                halt_on_failure=True,
-                                env=env,
-                                cwd=dirs['abs_mozilla_dir'],
-                                output_parser=None)
-
     def _mach_configure(self):
         """calls mach configure"""
         env = self.query_bootstrap_env()
         target = ["configure"]
         return self._mach(target=target, env=env)
 
-    def _get_mach_executable(self):
-        python = self.query_exe('python2.7')
-        return [python, 'mach']
-
     def _get_make_executable(self):
         config = self.config
         dirs = self.query_abs_dirs()
         if config.get('enable_mozmake'):  # e.g. windows
             make = r"/".join([dirs['abs_mozilla_dir'], 'mozmake.exe'])
             # mysterious subprocess errors, let's try to fix this path...
             make = make.replace('\\', '/')
             make = [make]