From f1d04044bd95ba5575f41e1efbc5cc0642d7cb2b Mon Sep 17 00:00:00 2001 From: Barret Rennie Date: Tue, 2 Jul 2019 17:29:33 +0000 Subject: [PATCH] Bug 1560193 - Always specify the Python executable to use when running `./mach browsertime` r=nalexander If `./mach browsertime` runs browsertime with a globally-installed node, due to an existing bug in [execa][1], the wrong Python will be executed. We now specify the full path of the Python binary we wish to use (via the `PYTHON` environment variable that our fork of browsertime supports) and avoid this issue altogether. [1]: https://github.com/sindresorhus/execa/issues/153 Differential Revision: https://phabricator.services.mozilla.com/D35374 --HG-- extra : moz-landing-system : lando --- tools/browsertime/mach_commands.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/browsertime/mach_commands.py b/tools/browsertime/mach_commands.py index 083a675199d36..dc549a22d67aa 100644 --- a/tools/browsertime/mach_commands.py +++ b/tools/browsertime/mach_commands.py @@ -273,12 +273,18 @@ def append_env(self, append_path=True): node_dir = os.path.dirname(self.node_path) path = [node_dir] + path - # Ensure that `/usr/bin/env python` in `visualmetrics.py` finds our - # virtualenv Python. - path = [os.path.dirname(self.virtualenv_manager.python_path)] + path - append_env = { 'PATH': os.pathsep.join(path), + + # Bug 1560193: The JS library browsertime uses to execute commands + # (execa) will muck up the PATH variable and put the directory that + # node is in first in path. If this is globally-installed node, + # that means `/usr/bin` will be inserted first which means that we + # will get `/usr/bin/python` for `python`. + # + # Our fork of browsertime supports a `PYTHON` environment variable + # that points to the exact python executable to use. + 'PYTHON': self.virtualenv_manager.python_path, } if path_to_imagemagick: