From fca5d2c97e152d191c95805bca0c622ff48646ea 2021-09-21 23:26:02 From: Blazej Michalik <6691643+MrMino@users.noreply.github.com> Date: 2021-09-21 23:26:02 Subject: [PATCH] Merge pull request #13149 from meeseeksmachine/auto-backport-of-pr-13094-on-7.x Backport PR #13094 on branch 7.x (Fix virtual environment user warning for lower case pathes) --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index a37cfc1..6571973 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -928,6 +928,11 @@ class InteractiveShell(SingletonConfigurable): elif len(str(p_venv)) >= 2 and str(p_venv)[1] == ":": p_venv = Path(str(p_venv)[2:]) + if sys.platform == "win32": + # On Windows there might be a mixture of lower-case and mixed-case paths + p_venv = Path(str(p_venv).lower()) + paths = [Path(str(p).lower()) for p in paths] + if any(os.fspath(p_venv) in os.fspath(p) for p in paths): # Our exe is inside or has access to the virtualenv, don't need to do anything. return