Bug 1714641: Remove usages of vendored "backports" code r=ahal,perftest-reviewers

It provides `shutil.which(...)`, which has been part of `shutil` since
Python 3.3.

Differential Revision: https://phabricator.services.mozilla.com/D117063
This commit is contained in:
Mitchell Hentges 2021-06-09 15:48:52 +00:00
parent ee204a6bef
commit e568fa2e0d
4 changed files with 3 additions and 14 deletions

View File

@ -291,7 +291,6 @@ def virtualenv_python3(env_python, build_env, mozconfig, help):
# Update the path to include some necessary modules for find_program.
sys.path.insert(0, os.path.join(topsrcdir, "testing", "mozbase", "mozfile"))
sys.path.insert(0, os.path.join(topsrcdir, "third_party", "python", "backports"))
# If we know the Python executable the caller is asking for then verify its
# version. If the caller did not ask for a specific executable then find

View File

@ -111,14 +111,10 @@ let's call the file ``flake8_lint.py`` (`in-tree version <https://searchfox.org/
import os
import subprocess
from collections import defaultdict
from shutil import which
from mozlint import result
try:
from shutil import which
except ImportError:
from shutil_which import which
FLAKE8_NOT_FOUND = """
Could not find flake8! Install flake8 and try again.

View File

@ -421,10 +421,7 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None, exts=None, extra_search_dirs=(
extra_search_dirs is a convenience argument. If provided, the strings in
the sequence will be appended to the END of the given `path`.
"""
try:
from shutil import which as shutil_which
except ImportError:
from shutil_which import which as shutil_which
from shutil import which as shutil_which
if isinstance(path, (list, tuple)):
path = os.pathsep.join(path)

View File

@ -174,10 +174,7 @@ class MachBrowsertime(MachCommandBase):
if not AUTOMATION and host_platform().startswith("linux"):
# On Linux ImageMagick needs to be installed manually, and `mach bootstrap` doesn't
# do that (yet). Provide some guidance.
try:
from shutil import which
except ImportError:
from shutil_which import which
from shutil import which
im_programs = ("compare", "convert", "mogrify")
for im_program in im_programs: