diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py index 4a28de4d315b5ca8108ac9ae327b6b6d53b63bf8..170e2bdc517612d5e0a13d6788315e05e4653a9e 100644 --- a/src/pip/_internal/wheel.py +++ b/src/pip/_internal/wheel.py @@ -163,13 +163,15 @@ def message_about_scripts_not_on_PATH(scripts): grouped_by_dir[parent_dir].add(script_name) # We don't want to warn for directories that are on PATH. - not_warn_dirs = os.environ["PATH"].split(os.pathsep) + not_warn_dirs = [ + os.path.normcase(i) for i in os.environ["PATH"].split(os.pathsep) + ] # If an executable sits with sys.executable, we don't warn for it. # This covers the case of venv invocations without activating the venv. - not_warn_dirs.append(os.path.dirname(sys.executable)) + not_warn_dirs.append(os.path.normcase(os.path.dirname(sys.executable))) warn_for = { parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items() - if parent_dir not in not_warn_dirs + if os.path.normcase(parent_dir) not in not_warn_dirs } if not warn_for: return None diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py index f1ee8e332c19fe20b50e6afb9576ff50c945659e..9b029eedbee47b88056e6ddd54280d0ddd9a04cb 100644 --- a/tests/unit/test_wheel.py +++ b/tests/unit/test_wheel.py @@ -453,3 +453,13 @@ class TestMessageAboutScriptsNotOnPATH(object): scripts=['/a/b/foo'] ) assert retval is None + + def test_PATH_check_case_insensitive_on_windows(self): + retval = self._template( + paths=['C:\\A\\b'], + scripts=['c:\\a\\b\\c', 'C:/A/b/d'] + ) + if WINDOWS: + assert retval is None + else: + assert retval is not None