Skip to content

Commit

Permalink
Bug 1560193 - Always specify the Python executable to use when runnin…
Browse files Browse the repository at this point in the history
…g `./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]: sindresorhus/execa#153

Differential Revision: https://phabricator.services.mozilla.com/D35374
  • Loading branch information
Barret Rennie committed Jul 2, 2019
1 parent c16f64d commit 2652000
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools/browsertime/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2652000

Please sign in to comment.