Bug 1563797 - Use 'backports.shutil_which' instead of 'which' in the build system r=firefox-build-system-reviewers,chmanchester

Credit: Callek for figuring out an issue in 'make check' making the binary
absolute in mozbuild.base.

Differential Revision: https://phabricator.services.mozilla.com/D37319
This commit is contained in:
Andrew Halberstadt
2019-07-11 14:04:39 +00:00
parent e16895aeb7
commit de1233b5da
7 changed files with 47 additions and 76 deletions

View File

@@ -14,11 +14,12 @@ import fnmatch
import glob
import errno
import re
from contextlib import contextmanager
import sys
import which
from contextlib import contextmanager
from distutils.dir_util import copy_tree
from mozfile import which
def symlink(source, link_name):
os_symlink = getattr(os, "symlink", None)
@@ -436,10 +437,10 @@ def get_tool(config, key):
return f
# Assume that we have the name of some program that should be on PATH.
try:
return which.which(f) if f else which.which(key)
except which.WhichError:
raise ValueError("%s not found on PATH" % f)
tool = which(f) if f else which(key)
if not tool:
raise ValueError("%s not found on PATH" % (f or key))
return tool
# This function is intended to be called on the final build directory when