diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 8252009c0..e724ced48 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -8,7 +8,6 @@ try: except ImportError: from cgi import escape as escape_html from distutils.version import LooseVersion -from distutils.spawn import find_executable import glob import multiprocessing.pool import operator @@ -36,6 +35,13 @@ else: from urllib.parse import parse_qs +def find_executable(exe): + for p in os.environ["PATH"].split(os.pathsep): + proposed_path = os.path.join(p, exe) + if os.access(proposed_path, os.X_OK): + return proposed_path + + def isMacOS10_12_5_OrLater(): """ Return whether this system is macOS 10.12.5 or a later version. """ version = platform.mac_ver()[0] @@ -1404,13 +1410,7 @@ fish_bin_dir = os.environ.get("__fish_bin_dir") fish_bin_path = None if not fish_bin_dir: print("The $__fish_bin_dir environment variable is not set. " "Looking in $PATH...") - # distutils.spawn is terribly broken, because it looks in wd before PATH, - # and doesn't actually validate that the file is even executable - for p in os.environ["PATH"].split(os.pathsep): - proposed_path = os.path.join(p, "fish") - if os.access(proposed_path, os.X_OK): - fish_bin_path = proposed_path - break + fish_bin_path = find_executable("fish") if not fish_bin_path: print("fish could not be found. Is fish installed correctly?") sys.exit(-1)