12 from PyQt6.QtCore import QProcess, QTimer, QUrl |
12 from PyQt6.QtCore import QProcess, QTimer, QUrl |
13 from PyQt6.QtGui import QDesktopServices |
13 from PyQt6.QtGui import QDesktopServices |
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
15 |
15 |
16 from eric7 import Preferences |
16 from eric7 import Preferences |
17 from eric7.Globals import getPythonExecutable, isWindowsPlatform |
17 from eric7.SystemUtilities import OSUtilities, PythonUtilities |
18 |
18 |
19 from .Ui_VirtualenvExecDialog import Ui_VirtualenvExecDialog |
19 from .Ui_VirtualenvExecDialog import Ui_VirtualenvExecDialog |
20 |
20 |
21 |
21 |
22 class VirtualenvExecDialog(QDialog, Ui_VirtualenvExecDialog): |
22 class VirtualenvExecDialog(QDialog, Ui_VirtualenvExecDialog): |
60 self.__calls = [] |
60 self.__calls = [] |
61 if configuration["pythonExe"]: |
61 if configuration["pythonExe"]: |
62 self.__calls.append((configuration["pythonExe"], ["-m", "venv"])) |
62 self.__calls.append((configuration["pythonExe"], ["-m", "venv"])) |
63 self.__calls.extend( |
63 self.__calls.extend( |
64 [ |
64 [ |
65 (getPythonExecutable(), ["-m", "venv"]), |
65 (PythonUtilities.getPythonExecutable(), ["-m", "venv"]), |
66 ("python3", ["-m", "venv"]), |
66 ("python3", ["-m", "venv"]), |
67 ("python", ["-m", "venv"]), |
67 ("python", ["-m", "venv"]), |
68 ] |
68 ] |
69 ) |
69 ) |
70 else: |
70 else: |
71 self.__calls = [ |
71 self.__calls = [ |
72 (getPythonExecutable(), ["-m", "virtualenv"]), |
72 (PythonUtilities.getPythonExecutable(), ["-m", "virtualenv"]), |
73 ("virtualenv", []), |
73 ("virtualenv", []), |
74 ] |
74 ] |
75 self.__callIndex = 0 |
75 self.__callIndex = 0 |
76 self.__callArgs = [] |
76 self.__callArgs = [] |
77 |
77 |
279 def __writeScriptFile(self): |
279 def __writeScriptFile(self): |
280 """ |
280 """ |
281 Private method to write a script file to the virtualenv directory. |
281 Private method to write a script file to the virtualenv directory. |
282 """ |
282 """ |
283 basename = "create_pyvenv" if self.__pyvenv else "create_virtualenv" |
283 basename = "create_pyvenv" if self.__pyvenv else "create_virtualenv" |
284 if isWindowsPlatform(): |
284 if OSUtilities.isWindowsPlatform(): |
285 script = os.path.join(self.__targetDir, basename + ".cmd") |
285 script = os.path.join(self.__targetDir, basename + ".cmd") |
286 txt = self.__cmd |
286 txt = self.__cmd |
287 else: |
287 else: |
288 script = os.path.join(self.__targetDir, basename + ".sh") |
288 script = os.path.join(self.__targetDir, basename + ".sh") |
289 txt = "#!/usr/bin/env sh\n\n" + self.__cmd |
289 txt = "#!/usr/bin/env sh\n\n" + self.__cmd |