##// END OF EJS Templates
Use pathlib parent relationships to compare virtualenv directories...
Mithil Poojary -
Show More
@@ -922,18 +922,7 b' class InteractiveShell(SingletonConfigurable):'
922 p = Path(os.readlink(p))
922 p = Path(os.readlink(p))
923 paths.append(p.resolve())
923 paths.append(p.resolve())
924
924
925 # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible
925 if any(p_venv == p.parents[1] for p in paths):
926 if str(p_venv).startswith("\\cygdrive"):
927 p_venv = Path(str(p_venv)[11:])
928 elif len(str(p_venv)) >= 2 and str(p_venv)[1] == ":":
929 p_venv = Path(str(p_venv)[2:])
930
931 if sys.platform == "win32":
932 # On Windows there might be a mixture of lower-case and mixed-case paths
933 p_venv = Path(str(p_venv).lower())
934 paths = [Path(str(p).lower()) for p in paths]
935
936 if any(os.fspath(p_venv) in os.fspath(p) for p in paths):
937 # Our exe is inside or has access to the virtualenv, don't need to do anything.
926 # Our exe is inside or has access to the virtualenv, don't need to do anything.
938 return
927 return
939
928
General Comments 0
You need to be logged in to leave comments. Login now