Bug 780698 - Part a: Give _run_make append_env and explicit_env arguments; r=gps
authorMs2ger <ms2ger@gmail.com>
Tue, 02 Oct 2012 10:24:11 +0200
changeset 108929 195e7907f7ba5c96c983558370895f202a865a71
parent 108928 9598fc30867529ca71116c30c937afee79b45aa4
child 108930 1b36381b4b6bb1122d9deee7c5fd504eadd28508
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersgps
bugs780698
milestone18.0a1
Bug 780698 - Part a: Give _run_make append_env and explicit_env arguments; r=gps
python/mozbuild/mozbuild/base.py
python/mozbuild/mozbuild/testing/mochitest.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -184,18 +184,19 @@ class MozbuildObject(object):
         """Convert a relative path in the source directory to a full path."""
         return os.path.join(self.topsrcdir, path)
 
     def _get_objdir_path(self, path):
         """Convert a relative path in the object directory to a full path."""
         return os.path.join(self.topobjdir, path)
 
     def _run_make(self, directory=None, filename=None, target=None, log=True,
-            srcdir=False, allow_parallel=True, line_handler=None, env=None,
-            ignore_errors=False, silent=True, print_directory=True):
+            srcdir=False, allow_parallel=True, line_handler=None,
+            append_env=None, explicit_env=None, ignore_errors=False,
+            silent=True, print_directory=True):
         """Invoke make.
 
         directory -- Relative directory to look for Makefile in.
         filename -- Explicit makefile to run.
         target -- Makefile target(s) to make. Can be a string or iterable of
             strings.
         srcdir -- If True, invoke make from the source directory tree.
             Otherwise, make will be invoked from the object directory.
@@ -237,17 +238,18 @@ class MozbuildObject(object):
         fn = self._run_command_in_objdir
 
         if srcdir:
             fn = self._run_command_in_srcdir
 
         params = {
             'args': args,
             'line_handler': line_handler,
-            'explicit_env': env,
+            'append_env': append_env,
+            'explicit_env': explicit_env,
             'log_level': logging.INFO,
             'require_unix_environment': True,
             'ignore_errors': ignore_errors,
         }
 
         if log:
             params['log_name'] = 'make'
 
@@ -319,16 +321,18 @@ class MozbuildObject(object):
         if explicit_env:
             use_env = explicit_env
         else:
             use_env.update(os.environ)
 
             if append_env:
                 use_env.update(append_env)
 
+        self.log(logging.DEBUG, 'process', {'env': use_env}, 'Environment: {env}')
+
         p = ProcessHandlerMixin(args, cwd=cwd, env=use_env,
             processOutputLine=[handleLine], universal_newlines=True)
         p.run()
         p.processOutput()
         status = p.wait()
 
         if status != 0 and not ignore_errors:
             raise Exception('Process executed with non-0 exit code: %s' % args)
--- a/python/mozbuild/mozbuild/testing/mochitest.py
+++ b/python/mozbuild/mozbuild/testing/mochitest.py
@@ -58,17 +58,17 @@ class MochitestRunner(MozbuildObject):
             target = 'mochitest-chrome'
         elif suite == 'browser':
             target = 'mochitest-browser-chrome'
         else:
             raise Exception('None or unrecognized mochitest suite type.')
 
         env = {'TEST_PATH': parsed['normalized']}
 
-        self._run_make(directory='.', target=target, env=env)
+        self._run_make(directory='.', target=target, append_env=env)
 
     def _parse_test_path(self, test_path):
         is_dir = os.path.isdir(test_path)
 
         if is_dir and not test_path.endswith(os.path.sep):
             test_path += os.path.sep
 
         normalized = test_path