ProjectPyramid/Project.py

branch
eric7
changeset 164
277a93891db9
parent 160
41b23683d5a1
child 166
8b0cc7528c70
equal deleted inserted replaced
163:e3ed5e2856d7 164:277a93891db9
13 import os 13 import os
14 import re 14 import re
15 import subprocess # secok 15 import subprocess # secok
16 import sys 16 import sys
17 17
18 from PyQt6.QtCore import pyqtSlot, QObject, QFileInfo, QTimer, QUrl, QIODeviceBase 18 from PyQt6.QtCore import (
19 QFileInfo,
20 QIODeviceBase,
21 QObject,
22 QProcess as QProcessPyQt,
23 QTimer,
24 QUrl,
25 pyqtSlot,
26 )
19 from PyQt6.QtGui import QDesktopServices 27 from PyQt6.QtGui import QDesktopServices
20 from PyQt6.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit 28 from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu
21 from PyQt6.QtCore import QProcess as QProcessPyQt
22 29
23 from eric7 import Preferences, Utilities 30 from eric7 import Preferences, Utilities
24 from eric7.EricGui.EricAction import EricAction 31 from eric7.EricGui.EricAction import EricAction
32 from eric7.EricWidgets import EricFileDialog, EricMessageBox
25 from eric7.EricWidgets.EricApplication import ericApp 33 from eric7.EricWidgets.EricApplication import ericApp
26 from eric7.EricWidgets import EricMessageBox, EricFileDialog 34
27 from eric7.Globals import isWindowsPlatform 35 try:
36 from eric7.SystemUtilities.FileSystemUtilities import (
37 getExecutablePath,
38 getExecutablePaths,
39 )
40 except ImportError:
41 # imports for eric < 23.1
42 from eric7.Utilities import getExecutablePath, getExecutablePaths
43 try:
44 from eric7.SystemUtilities.OSUtilities import isWindowsPlatform
45 except ImportError:
46 # imports for eric < 23.1
47 from eric7.Globals import isWindowsPlatform
28 48
29 try: 49 try:
30 from eric7.EricGui import EricPixmapCache 50 from eric7.EricGui import EricPixmapCache
31 except ImportError: 51 except ImportError:
32 from UI import PixmapCache as EricPixmapCache 52 from UI import PixmapCache as EricPixmapCache
838 if fullCmd != cmd: 858 if fullCmd != cmd:
839 variants.append(variant) 859 variants.append(variant)
840 else: 860 else:
841 if cmd: 861 if cmd:
842 try: 862 try:
843 fullCmds = Utilities.getExecutablePaths(cmd) 863 fullCmds = getExecutablePaths(cmd)
844 except AttributeError: 864 except AttributeError:
845 fullCmds = self.__getExecutablePaths(cmd) 865 fullCmds = self.__getExecutablePaths(cmd)
846 for fullCmd in fullCmds: 866 for fullCmd in fullCmds:
847 try: 867 try:
848 with open(fullCmd, "r", encoding="utf-8") as f: 868 with open(fullCmd, "r", encoding="utf-8") as f:
971 break 991 break
972 else: 992 else:
973 fullCmds = [ 993 fullCmds = [
974 os.path.join(virtualEnv, "bin", cmd), 994 os.path.join(virtualEnv, "bin", cmd),
975 os.path.join(virtualEnv, "local", "bin", cmd), 995 os.path.join(virtualEnv, "local", "bin", cmd),
976 Utilities.getExecutablePath(cmd), 996 getExecutablePath(cmd),
977 cmd, # fall back to just cmd 997 cmd, # fall back to just cmd
978 ] 998 ]
979 for cmd in fullCmds: 999 for cmd in fullCmds:
980 if os.path.exists(cmd): 1000 if os.path.exists(cmd):
981 break 1001 break
1419 ), 1439 ),
1420 ) 1440 )
1421 return 1441 return
1422 1442
1423 args = Utilities.parseOptionString(consoleCmd) 1443 args = Utilities.parseOptionString(consoleCmd)
1424 args[0] = Utilities.getExecutablePath(args[0]) 1444 args[0] = getExecutablePath(args[0])
1425 args.append( 1445 args.append(
1426 self.getPyramidCommand( 1446 self.getPyramidCommand(
1427 "pserve", virtualEnv=self.getProjectVirtualEnvironment() 1447 "pserve", virtualEnv=self.getProjectVirtualEnvironment()
1428 ) 1448 )
1429 ) 1449 )
1520 ), 1540 ),
1521 ) 1541 )
1522 return 1542 return
1523 1543
1524 args = Utilities.parseOptionString(consoleCmd) 1544 args = Utilities.parseOptionString(consoleCmd)
1525 args[0] = Utilities.getExecutablePath(args[0]) 1545 args[0] = getExecutablePath(args[0])
1526 args.append( 1546 args.append(
1527 self.getPyramidCommand( 1547 self.getPyramidCommand(
1528 "pshell", virtualEnv=self.getProjectVirtualEnvironment() 1548 "pshell", virtualEnv=self.getProjectVirtualEnvironment()
1529 ) 1549 )
1530 ) 1550 )

eric ide

mercurial