diff --git a/testing/mozharness/mozharness/base/python.py b/testing/mozharness/mozharness/base/python.py index fa5daa649bcb..ef109a497056 100644 --- a/testing/mozharness/mozharness/base/python.py +++ b/testing/mozharness/mozharness/base/python.py @@ -113,18 +113,21 @@ class VirtualenvMixin(object): optional, two_pass, editable)) def query_virtualenv_path(self): - c = self.config + """Determine the absolute path to the virtualenv.""" dirs = self.query_abs_dirs() - virtualenv = None + if 'abs_virtualenv_dir' in dirs: - virtualenv = dirs['abs_virtualenv_dir'] - elif c.get('virtualenv_path'): - if os.path.isabs(c['virtualenv_path']): - virtualenv = c['virtualenv_path'] - else: - virtualenv = os.path.join(dirs['abs_work_dir'], - c['virtualenv_path']) - return virtualenv + return dirs['abs_virtualenv_dir'] + + p = self.config['virtualenv_path'] + if not p: + self.fatal('virtualenv_path config option not set; ' + 'this should never happen') + + if os.path.isabs(p): + return p + else: + return os.path.join(dirs['abs_work_dir'], p) def query_python_path(self, binary="python"): """Return the path of a binary inside the virtualenv, if @@ -136,10 +139,8 @@ class VirtualenvMixin(object): if self._is_windows(): bin_dir = 'Scripts' virtualenv_path = self.query_virtualenv_path() - if virtualenv_path: - self.python_paths[binary] = os.path.abspath(os.path.join(virtualenv_path, bin_dir, binary)) - else: - self.python_paths[binary] = self.query_exe(binary) + self.python_paths[binary] = os.path.abspath(os.path.join(virtualenv_path, bin_dir, binary)) + return self.python_paths[binary] def query_python_site_packages_path(self):