11 import re |
11 import re |
12 |
12 |
13 from PyQt6.QtCore import QProcess, QTimer, pyqtSlot |
13 from PyQt6.QtCore import QProcess, QTimer, pyqtSlot |
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
15 |
15 |
16 from eric7 import Globals, Preferences, Utilities |
16 from eric7 import Globals, Preferences |
17 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
17 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
|
18 from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities |
18 |
19 |
19 from .Ui_VirtualenvUpgradeConfigurationDialog import ( |
20 from .Ui_VirtualenvUpgradeConfigurationDialog import ( |
20 Ui_VirtualenvUpgradeConfigurationDialog, |
21 Ui_VirtualenvUpgradeConfigurationDialog, |
21 ) |
22 ) |
22 |
23 |
43 super().__init__(parent) |
44 super().__init__(parent) |
44 self.setupUi(self) |
45 self.setupUi(self) |
45 |
46 |
46 self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
47 self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
47 self.pythonExecPicker.setWindowTitle(self.tr("Python Interpreter")) |
48 self.pythonExecPicker.setWindowTitle(self.tr("Python Interpreter")) |
48 self.pythonExecPicker.setDefaultDirectory(Globals.getPythonExecutable()) |
49 self.pythonExecPicker.setDefaultDirectory(PythonUtilities.getPythonExecutable()) |
49 |
50 |
50 self.envNameLabel.setText(envName) |
51 self.envNameLabel.setText(envName) |
51 self.envDirectoryLabel.setText(envPath) |
52 self.envDirectoryLabel.setText(envPath) |
52 |
53 |
53 self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""") |
54 self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""") |
71 calls = [] |
72 calls = [] |
72 if self.pythonExecPicker.text(): |
73 if self.pythonExecPicker.text(): |
73 calls.append((self.pythonExecPicker.text(), ["-m", "venv"])) |
74 calls.append((self.pythonExecPicker.text(), ["-m", "venv"])) |
74 calls.extend( |
75 calls.extend( |
75 [ |
76 [ |
76 (Globals.getPythonExecutable(), ["-m", "venv"]), |
77 (PythonUtilities.getPythonExecutable(), ["-m", "venv"]), |
77 ("python3", ["-m", "venv"]), |
78 ("python3", ["-m", "venv"]), |
78 ("python", ["-m", "venv"]), |
79 ("python", ["-m", "venv"]), |
79 ] |
80 ] |
80 ) |
81 ) |
81 |
82 |
147 if self.upgradeDepsCheckBox.isChecked(): |
148 if self.upgradeDepsCheckBox.isChecked(): |
148 args.append("--upgrade-deps") |
149 args.append("--upgrade-deps") |
149 args.append(self.envDirectoryLabel.text()) |
150 args.append(self.envDirectoryLabel.text()) |
150 |
151 |
151 return ( |
152 return ( |
152 Utilities.toNativeSeparators(self.pythonExecPicker.text()), |
153 FileSystemUtilities.toNativeSeparators(self.pythonExecPicker.text()), |
153 args, |
154 args, |
154 self.logCheckBox.isChecked(), |
155 self.logCheckBox.isChecked(), |
155 ) |
156 ) |