mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This allows the test environment to see pylint.exe when installed with
  `pip install --user`, since it isn't normally on PATH.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9535

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3474,7 +3474,29 @@
             path = os.environ['PATH'].split(os.pathsep)
             while exedir in path:
                 path.remove(exedir)
-            os.environ['PATH'] = os.pathsep.join([exedir] + path)
+
+            # Binaries installed by pip into the user area like pylint.exe may
+            # not be in PATH by default.
+            extra_paths = [exedir]
+            vi = sys.version_info
+            if 'APPDATA' in os.environ:
+                scripts_dir = os.path.join(
+                    os.environ['APPDATA'],
+                    'Python',
+                    'Python%d%d' % (vi[0], vi[1]),
+                    'Scripts',
+                )
+
+                if vi.major == 2:
+                    scripts_dir = os.path.join(
+                        os.environ['APPDATA'],
+                        'Python',
+                        'Scripts',
+                    )
+
+                extra_paths.append(scripts_dir)
+
+            os.environ['PATH'] = os.pathsep.join(extra_paths + path)
             if not self._findprogram(pyexename):
                 print("WARNING: Cannot find %s in search path" % pyexename)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to