From 8c9517316427207278fbb153f272b4ceae3f5f4d Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Fri, 12 May 2017 15:18:46 -0600 Subject: [PATCH] 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 | 4 ++++ testing/mozharness/mozharness/base/python.py | 9 +++++---- testing/mozharness/mozharness/mozilla/testing/talos.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/testing/mozharness/configs/talos/windows_config.py b/testing/mozharness/configs/talos/windows_config.py index 219c07276ddd..5f24a7372b1e 100644 --- a/testing/mozharness/configs/talos/windows_config.py +++ b/testing/mozharness/configs/talos/windows_config.py @@ -49,5 +49,9 @@ config = { "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;" } } diff --git a/testing/mozharness/mozharness/base/python.py b/testing/mozharness/mozharness/base/python.py index 9c0b8dce80a3..03f696c212ef 100644 --- a/testing/mozharness/mozharness/base/python.py +++ b/testing/mozharness/mozharness/base/python.py @@ -811,7 +811,7 @@ class Python3Virtualenv(object): 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) @@ -843,7 +843,8 @@ class Python3Virtualenv(object): 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): @@ -851,7 +852,7 @@ class Python3Virtualenv(object): 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''' @@ -887,7 +888,7 @@ class Python3Virtualenv(object): 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 diff --git a/testing/mozharness/mozharness/mozilla/testing/talos.py b/testing/mozharness/mozharness/mozilla/testing/talos.py index aee265e55fd3..3baaa16843bb 100755 --- a/testing/mozharness/mozharness/mozilla/testing/talos.py +++ b/testing/mozharness/mozharness/mozilla/testing/talos.py @@ -511,5 +511,5 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin, 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