7 Module implementing a dialog to enter the parameters for the |
7 Module implementing a dialog to enter the parameters for the |
8 virtual environment. |
8 virtual environment. |
9 """ |
9 """ |
10 |
10 |
11 import os |
11 import os |
12 import sys |
|
13 import re |
12 import re |
14 |
13 |
15 from PyQt6.QtCore import pyqtSlot, QProcess, QTimer |
14 from PyQt6.QtCore import pyqtSlot, QProcess, QTimer |
16 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
15 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
17 |
16 |
18 from EricWidgets.EricPathPicker import EricPathPickerModes |
17 from EricWidgets.EricPathPicker import EricPathPickerModes |
19 from EricWidgets.EricApplication import ericApp |
18 from EricWidgets.EricApplication import ericApp |
20 |
19 |
21 from .Ui_VirtualenvConfigurationDialog import Ui_VirtualenvConfigurationDialog |
20 from .Ui_VirtualenvConfigurationDialog import Ui_VirtualenvConfigurationDialog |
22 |
21 |
|
22 import Globals |
23 import Preferences |
23 import Preferences |
24 import Utilities |
24 import Utilities |
25 |
25 |
26 import CondaInterface |
26 import CondaInterface |
27 |
27 |
60 |
60 |
61 self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
61 self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
62 self.pythonExecPicker.setWindowTitle( |
62 self.pythonExecPicker.setWindowTitle( |
63 self.tr("Python Interpreter")) |
63 self.tr("Python Interpreter")) |
64 self.pythonExecPicker.setDefaultDirectory( |
64 self.pythonExecPicker.setDefaultDirectory( |
65 sys.executable.replace("w.exe", ".exe")) |
65 Globals.getPythonExecutable()) |
66 |
66 |
67 self.condaTargetDirectoryPicker.setMode( |
67 self.condaTargetDirectoryPicker.setMode( |
68 EricPathPickerModes.DIRECTORY_MODE) |
68 EricPathPickerModes.DIRECTORY_MODE) |
69 self.condaTargetDirectoryPicker.setWindowTitle( |
69 self.condaTargetDirectoryPicker.setWindowTitle( |
70 self.tr("Conda Environment Location")) |
70 self.tr("Conda Environment Location")) |
330 calls = [] |
330 calls = [] |
331 if self.pythonExecPicker.text(): |
331 if self.pythonExecPicker.text(): |
332 calls.append((self.pythonExecPicker.text(), |
332 calls.append((self.pythonExecPicker.text(), |
333 ["-m", "virtualenv", "--version"])) |
333 ["-m", "virtualenv", "--version"])) |
334 calls.extend([ |
334 calls.extend([ |
335 (sys.executable.replace("w.exe", ".exe"), |
335 (Globals.getPythonExecutable(), ["-m", "virtualenv", "--version"]), |
336 ["-m", "virtualenv", "--version"]), |
|
337 ("virtualenv", ["--version"]), |
336 ("virtualenv", ["--version"]), |
338 ]) |
337 ]) |
339 |
338 |
340 proc = QProcess() |
339 proc = QProcess() |
341 for prog, args in calls: |
340 for prog, args in calls: |
383 calls = [] |
382 calls = [] |
384 if self.pythonExecPicker.text(): |
383 if self.pythonExecPicker.text(): |
385 calls.append((self.pythonExecPicker.text(), |
384 calls.append((self.pythonExecPicker.text(), |
386 ["-m", "venv"])) |
385 ["-m", "venv"])) |
387 calls.extend([ |
386 calls.extend([ |
388 (sys.executable.replace("w.exe", ".exe"), |
387 (Globals.getPythonExecutable(), ["-m", "venv"]), |
389 ["-m", "venv"]), |
|
390 ("python3", ["-m", "venv"]), |
388 ("python3", ["-m", "venv"]), |
391 ("python", ["-m", "venv"]), |
389 ("python", ["-m", "venv"]), |
392 ]) |
390 ]) |
393 |
391 |
394 proc = QProcess() |
392 proc = QProcess() |