Bug 1304176 - Install psutil and mozsystemmonitor from source checkout; r?ted draft
authorGregory Szorc <gps@mozilla.com>
Wed, 21 Sep 2016 11:11:45 -0700
changeset 416243 c14350f627929fa7b2be3e21e981f305f811f9b9
parent 416242 42e5cf8b24a896cb259fab065f69efa9b7b32421
child 531787 89678db43d10247c613152a7fe16c4153cd74f22
push id30070
push usergszorc@mozilla.com
push dateWed, 21 Sep 2016 18:14:36 +0000
Bug 1304176 - Install psutil and mozsystemmonitor from source checkout; r?ted Automation spends time downloading psutil and mozsystemmonitor from an external host. These packages are vendored in the source repo. This commit changes mozharness to use the vendored copy if available. MozReview-Commit-ID: K6GtUiXf66M
--- a/testing/mozharness/mozharness/base/python.py
+++ b/testing/mozharness/mozharness/base/python.py
@@ -507,22 +507,28 @@ class ResourceMonitoringMixin(object):
     While we would like to record resource usage for the entirety of a script,
     since we require an external package, we can only record resource usage
     after that package is installed (as part of creating the virtualenv).
     That's just the way things have to be.
     def __init__(self, *args, **kwargs):
         super(ResourceMonitoringMixin, self).__init__(*args, **kwargs)
-        self.register_virtualenv_module('psutil>=3.1.1', method='pip',
+        if self.topsrcdir:
+            psutil = os.path.join(self.topsrcdir, 'python', 'psutil')
+            mozsystemmonitor = os.path.join(self.topsrcdir, 'testing',
+                                            'mozbase', 'mozsystemmonitor')
+        else:
+            psutil = 'psutil>=3.1.1'
+            mozsystemmonitor = 'mozsystemmonitor==0.3'
+        self.register_virtualenv_module(psutil, method='pip', optional=True)
+        self.register_virtualenv_module(mozsystemmonitor, method='pip',
-        self.register_virtualenv_module('mozsystemmonitor==0.3',
-                                        method='pip', optional=True)
-        self.register_virtualenv_module('jsonschema==2.5.1',
-                                        method='pip')
+        self.register_virtualenv_module('jsonschema==2.5.1', method='pip')
         # explicitly install functools32, because some slaves aren't using
         # a version of pip recent enough to install it automatically with
         # jsonschema (which depends on it)
         # https://github.com/Julian/jsonschema/issues/233
         self._resource_monitor = None