Bug 1361732 - Use custom PATH for python3; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Fri, 12 May 2017 15:18:46 -0600
changeset 358253 41bf163ee237c8ed2ab37619048a94e066ec7a12
parent 358252 4e1be5755d6a9e9751085a05bbc421be434007ca
child 358254 6afcef838b7ecb0db0866c83171d18b6118d883f
push id31819
push userarchaeopteryx@coole-files.de
push dateSun, 14 May 2017 16:04:50 +0000
treeherdermozilla-central@626efff0df63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1361732
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1361732 - Use custom PATH for python3; r=jmaher Since we are running python3 from an embeddable zip installation, a C runtime environment is required, on Windows. We manipulate the PATH to pick it up from the firefox installation.
testing/mozharness/configs/talos/windows_config.py
testing/mozharness/mozharness/base/python.py
testing/mozharness/mozharness/mozilla/testing/talos.py
--- a/testing/mozharness/configs/talos/windows_config.py
+++ b/testing/mozharness/configs/talos/windows_config.py
@@ -44,10 +44,14 @@ config = {
     "metro_harness_path_frmt": "%(metro_base_path)s/metro/metrotestharness.exe",
     "download_minidump_stackwalk": True,
     "tooltool_cache": os.path.join('c:\\', 'build', 'tooltool_cache'),
     "minidump_stackwalk_path": "win32-minidump_stackwalk.exe",
     "minidump_tooltool_manifest_path": "config/tooltool-manifests/win32/releng.manifest",
     "python3_manifest": {
         "win32": "python3.manifest",
         "win64": "python3_x64.manifest",
+    },
+    "env": {
+        # python3 requires C runtime, found in firefox installation; see bug 1361732
+        "PATH": "%(PATH)s;c:\\slave\\test\\build\\application\\firefox;"
     }
 }
--- a/testing/mozharness/mozharness/base/python.py
+++ b/testing/mozharness/mozharness/base/python.py
@@ -806,17 +806,17 @@ class Python3Virtualenv(object):
         '''We don't use __init__ to allow integrating with other mixins.
 
         python_path - Path to Python 3 binary.
         venv_path - Path to virtual environment to be created.
         '''
         self.py3_initialized_venv = True
         self.py3_python_path = os.path.abspath(python_path)
         version = self.get_output_from_command(
-                    [self.py3_python_path, '--version']).split()[-1]
+                    [self.py3_python_path, '--version'], env=self.query_env()).split()[-1]
         # Using -m venv is only used on 3.5+ versions
         assert version > '3.5.0'
         self.py3_venv_path = os.path.abspath(venv_path)
         self.py3_pip_path = os.path.join(self.py3_path_to_executables(), 'pip')
 
     def py3_path_to_executables(self):
         platform = self.platform_name()
         if platform.startswith('win'):
@@ -838,25 +838,26 @@ class Python3Virtualenv(object):
         if os.path.exists(self.py3_venv_path):
             self.info("Virtualenv %s appears to already exist; skipping "
                       "virtualenv creation." % self.py3_venv_path)
         else:
             self.info('Running command...')
             self.run_command(
                 '%s -m venv %s' % (self.py3_python_path, self.py3_venv_path),
                 error_list=VirtualenvErrorList,
-                halt_on_failure=True)
+                halt_on_failure=True,
+                env=self.query_env())
 
     @py3_venv_initialized
     def py3_install_modules(self, modules):
         if not os.path.exists(self.py3_venv_path):
             raise Exception('You need to call py3_create_venv() first.')
 
         for m in modules:
-            self.run_command('%s install %s' % (self.py3_pip_path, m))
+            self.run_command('%s install %s' % (self.py3_pip_path, m), env=self.query_env())
 
     def _mozharness_pip_args(self):
         '''We have information in Mozharness configs that apply to pip'''
         c = self.config
         pip_args = []
         # To avoid timeouts with our pypi server, increase default timeout:
         # https://bugzilla.mozilla.org/show_bug.cgi?id=1007230#c802
         pip_args += ['--timeout', str(c.get('pip_timeout', 120))]
@@ -882,17 +883,17 @@ class Python3Virtualenv(object):
             cmd += [' ' + arg]
 
         if use_mozharness_pip_config:
             cmd += self._mozharness_pip_args()
 
         for requirement_path in requirements:
             cmd += ['-r %s' % requirement_path]
 
-        self.run_command(' '.join(cmd))
+        self.run_command(cmd, env=self.query_env())
 
 
 # __main__ {{{1
 
 if __name__ == '__main__':
     '''TODO: unit tests.
     '''
     pass
--- a/testing/mozharness/mozharness/mozilla/testing/talos.py
+++ b/testing/mozharness/mozharness/mozilla/testing/talos.py
@@ -506,10 +506,10 @@ class Talos(TestingMixin, MercurialScrip
         output_dir = self.query_abs_dirs()['abs_work_dir']
         # Slowdown: The unzipped Python3 installation gets deleted every time
         self.tooltool_fetch(
             manifest_file,
             output_dir=output_dir,
             cache=self.config['tooltool_cache']
         )
         python3_path = os.path.join(output_dir, 'python3.6', 'python')
-        self.run_command([python3_path, '--version'])
+        self.run_command([python3_path, '--version'], env=self.query_env())
         return python3_path