14 import sys |
14 import sys |
15 |
15 |
16 from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot |
16 from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot |
17 from PyQt6.QtWidgets import QDialog |
17 from PyQt6.QtWidgets import QDialog |
18 |
18 |
19 from eric7 import Globals, Preferences, Utilities |
19 from eric7 import Preferences |
20 from eric7.EricWidgets import EricMessageBox |
20 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets.EricApplication import ericApp |
21 from eric7.EricWidgets.EricApplication import ericApp |
|
22 from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities |
22 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
23 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
23 |
24 |
24 |
25 |
25 class VirtualenvManager(QObject): |
26 class VirtualenvManager(QObject): |
26 """ |
27 """ |
105 # now remove unsupported environments |
106 # now remove unsupported environments |
106 for venvName in envsToDelete: |
107 for venvName in envsToDelete: |
107 del environments[venvName] |
108 del environments[venvName] |
108 |
109 |
109 # check, if the interpreter used to run eric is in the environments |
110 # check, if the interpreter used to run eric is in the environments |
110 defaultPy = Globals.getPythonExecutable() |
111 defaultPy = PythonUtilities.getPythonExecutable() |
111 if "{0}.venv{0}".format(os.sep) not in defaultPy: |
112 if "{0}.venv{0}".format(os.sep) not in defaultPy: |
112 # only check for a non-embedded environment |
113 # only check for a non-embedded environment |
113 found = False |
114 found = False |
114 for venvName in self.__virtualEnvironments: |
115 for venvName in self.__virtualEnvironments: |
115 if os.path.samefile( |
116 if os.path.samefile( |
182 @type str |
183 @type str |
183 @return tuple containing the environment name and a dictionary |
184 @return tuple containing the environment name and a dictionary |
184 containing a copy of the default virtual environment |
185 containing a copy of the default virtual environment |
185 @rtype tuple of (str, dict) |
186 @rtype tuple of (str, dict) |
186 """ |
187 """ |
187 py = Utilities.normcaseabspath(interpreter.replace("w.exe", ".exe")) |
188 py = FileSystemUtilities.normcaseabspath(interpreter.replace("w.exe", ".exe")) |
188 for venvName in self.__virtualEnvironments: |
189 for venvName in self.__virtualEnvironments: |
189 if py == Utilities.normcaseabspath( |
190 if py == FileSystemUtilities.normcaseabspath( |
190 self.__virtualEnvironments[venvName]["interpreter"] |
191 self.__virtualEnvironments[venvName]["interpreter"] |
191 ): |
192 ): |
192 return (venvName, copy.copy(self.__virtualEnvironments[venvName])) |
193 return (venvName, copy.copy(self.__virtualEnvironments[venvName])) |
193 |
194 |
194 if os.path.samefile(interpreter, sys.executable): |
195 if os.path.samefile(interpreter, sys.executable): |