Bug 1384731 - Allow which to find files in paths that use the ~ character to represent the home directory r=gps
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 26 Jul 2017 15:43:07 -0600
changeset 420385 b6ef3ef539fc348a3b365a1e52200af60ebefa9d
parent 420384 2b9ebd337cf1b214e7f3de43a2b2cb9e756c2b31
child 420386 bb231507aab86fa5e5b32d3275236937c20ce1a2
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1384731
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384731 - Allow which to find files in paths that use the ~ character to represent the home directory r=gps MozReview-Commit-ID: FeV1k9Piwuo
third_party/python/which/which.py
--- a/third_party/python/which/which.py
+++ b/third_party/python/which/which.py
@@ -193,17 +193,18 @@ def whichgen(command, path=None, verbose
         for i in range(len(path)):
             dirName = path[i]
             # On windows the dirName *could* be quoted, drop the quotes
             if sys.platform.startswith("win") and len(dirName) >= 2\
                and dirName[0] == '"' and dirName[-1] == '"':
                 dirName = dirName[1:-1]
             for ext in ['']+exts:
                 absName = os.path.abspath(
-                    os.path.normpath(os.path.join(dirName, command+ext)))
+                    os.path.expanduser(
+                    os.path.normpath(os.path.join(dirName, command+ext))))
                 if os.path.isfile(absName):
                     if usingGivenPath:
                         fromWhere = "from given path element %d" % i
                     elif not sys.platform.startswith("win"):
                         fromWhere = "from PATH element %d" % i
                     elif i == 0:
                         fromWhere = "from current directory"
                     else: