Changed virtualenv manager to not create an entry for an embedded environment. eric7

Tue, 18 Oct 2022 16:33:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 18 Oct 2022 16:33:23 +0200
branch
eric7
changeset 9418
93698f6003d3
parent 9417
10b027c85e78
child 9419
175ec2fe27ca

Changed virtualenv manager to not create an entry for an embedded environment.

src/eric7/VirtualEnv/VirtualenvManager.py file | annotate | diff | comparison | revisions
--- a/src/eric7/VirtualEnv/VirtualenvManager.py	Tue Oct 18 16:24:57 2022 +0200
+++ b/src/eric7/VirtualEnv/VirtualenvManager.py	Tue Oct 18 16:33:23 2022 +0200
@@ -104,22 +104,24 @@
 
         # check, if the interpreter used to run eric is in the environments
         defaultPy = Globals.getPythonExecutable()
-        found = False
-        for venvName in self.__virtualEnvironments:
-            if defaultPy == self.__virtualEnvironments[venvName]["interpreter"]:
-                found = True
-                break
-        if not found:
-            # add an environment entry for the default interpreter
-            self.__virtualEnvironments[VirtualenvManager.DefaultKey] = {
-                "path": "",
-                "interpreter": defaultPy,
-                "variant": 3,
-                "is_global": True,
-                "is_conda": False,
-                "is_remote": False,
-                "exec_path": "",
-            }
+        if "{0}.venv{0}".format(os.sep) not in defaultPy:
+            # only check for a non-embedded environment
+            found = False
+            for venvName in self.__virtualEnvironments:
+                if defaultPy == self.__virtualEnvironments[venvName]["interpreter"]:
+                    found = True
+                    break
+            if not found:
+                # add an environment entry for the default interpreter
+                self.__virtualEnvironments[VirtualenvManager.DefaultKey] = {
+                    "path": "",
+                    "interpreter": defaultPy,
+                    "variant": 3,
+                    "is_global": True,
+                    "is_conda": False,
+                    "is_remote": False,
+                    "exec_path": "",
+                }
 
         self.__saveSettings()
 

eric ide

mercurial