Bug 1453658 - Use pip options when install python3 modules. r=bhearsum, a=test-only
authorTom Prince <mozilla@hocat.ca>
Thu, 12 Apr 2018 10:17:50 -0600
changeset 460838 b36fb5458ecbde976a48ec0644d3b88154325eb8
parent 460837 1979fbb0fb9364067a2ae0bb2201166f1ef3c418
child 460839 1cf6b6ff8bd2d01bf14175640971f1c28d1ea7fe
push id9069
push userryanvm@gmail.com
push dateMon, 16 Apr 2018 17:52:45 +0000
treeherdermozilla-beta@1cf6b6ff8bd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhearsum, test-only
bugs1453658
milestone60.0
Bug 1453658 - Use pip options when install python3 modules. r=bhearsum, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D924
testing/mozharness/mozharness/base/python.py
--- a/testing/mozharness/mozharness/base/python.py
+++ b/testing/mozharness/mozharness/base/python.py
@@ -774,22 +774,27 @@ class Python3Virtualenv(object):
             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,
                 env=self.query_env())
 
     @py3_venv_initialized
-    def py3_install_modules(self, modules):
+    def py3_install_modules(self, modules,
+                            use_mozharness_pip_config=True):
         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), env=self.query_env())
+            cmd = [self.py3_pip_path, 'install']
+            if use_mozharness_pip_config:
+                cmd += self._mozharness_pip_args()
+            cmd += [m]
+            self.run_command(cmd, 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))]