ProjectDjango/Project.py

branch
eric7
changeset 188
b08c2cb2e0a0
parent 184
9585686bc532
child 190
f394b11f9f31
diff -r 6d0d13de1005 -r b08c2cb2e0a0 ProjectDjango/Project.py
--- a/ProjectDjango/Project.py	Sat Nov 26 17:32:34 2022 +0100
+++ b/ProjectDjango/Project.py	Wed Dec 21 09:27:28 2022 +0100
@@ -12,10 +12,16 @@
 import re
 import shutil
 
-from PyQt6.QtCore import QObject, QTimer, QUrl, QFileInfo, QIODeviceBase
+from PyQt6.QtCore import (
+    QFileInfo,
+    QIODeviceBase,
+    QObject,
+    QProcess as QProcessPyQt,
+    QTimer,
+    QUrl,
+)
 from PyQt6.QtGui import QDesktopServices
-from PyQt6.QtWidgets import QMenu, QInputDialog, QLineEdit, QDialog
-from PyQt6.QtCore import QProcess as QProcessPyQt
+from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu
 
 from eric7 import Preferences, Utilities
 
@@ -23,10 +29,25 @@
     from eric7.EricGui import EricPixmapCache
 except ImportError:
     from UI import PixmapCache as EricPixmapCache
+
 from eric7.EricGui.EricAction import EricAction
-from eric7.EricWidgets import EricMessageBox, EricFileDialog
+from eric7.EricWidgets import EricFileDialog, EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
-from eric7.Globals import isWindowsPlatform
+
+try:
+    from eric7.SystemUtilities.OSUtilities import isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform
+try:
+    from eric7.SystemUtilities.FileSystemUtilities import (
+        getExecutablePath,
+        getExecutablePaths,
+        isinpath,
+    )
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Utilities import getExecutablePath, getExecutablePaths, isinpath
 
 from .DjangoDialog import DjangoDialog
 
@@ -1374,7 +1395,7 @@
                 else:
                     if cmd:
                         try:
-                            fullCmds = Utilities.getExecutablePaths(cmd)
+                            fullCmds = getExecutablePaths(cmd)
                         except AttributeError:
                             fullCmds = self.__getExecutablePaths(cmd)
                         for fullCmd in fullCmds:
@@ -1529,7 +1550,7 @@
                     cmds = []
                 cmds.extend(["django-admin", "django-admin.py"])
                 for cmd in cmds:
-                    if Utilities.isinpath(cmd):
+                    if isinpath(cmd):
                         break
                 else:
                     cmd = ""
@@ -1898,7 +1919,7 @@
         args = []
         cmd = self.__getDjangoAdminCommand()
         if cmd:
-            if Utilities.isWindowsPlatform():
+            if isWindowsPlatform():
                 args.append(self.__getPythonExecutable())
             args.append(cmd)
         else:
@@ -1980,7 +2001,7 @@
         if isGlobal:
             cmd = self.__getDjangoAdminCommand()
             if cmd:
-                if Utilities.isWindowsPlatform():
+                if isWindowsPlatform():
                     args.append(self.__getPythonExecutable())
                 args.append(cmd)
             else:
@@ -2172,7 +2193,7 @@
         )[1]
         if consoleCmd:
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(self.__getPythonExecutable())
             args.append("manage.py")
             args.append("runserver")
@@ -2185,7 +2206,7 @@
                 args.append(addr)
 
             with contextlib.suppress(DjangoNoSiteSelectedError):
-                if Utilities.isWindowsPlatform():
+                if isWindowsPlatform():
                     serverProcStarted, pid = QProcess.startDetached(
                         args[0], args[1:], self.__sitePath()
                     )
@@ -2431,7 +2452,7 @@
         )[1]
         if consoleCmd:
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(self.__getPythonExecutable())
             args.append("manage.py")
             args.append("dbshell")
@@ -2882,7 +2903,7 @@
         )[1]
         if consoleCmd:
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(self.__getPythonExecutable())
             args.append("manage.py")
             args.append("shell")
@@ -3078,7 +3099,7 @@
                 self.__plugin.setPreferences("KeepTestDatabase", keep)
 
                 args = Utilities.parseOptionString(consoleCmd)
-                args[0] = Utilities.getExecutablePath(args[0])
+                args[0] = getExecutablePath(args[0])
                 args.append(self.__getPythonExecutable())
                 if deprecation:
                     args.append("-Wall")
@@ -3121,7 +3142,7 @@
                 fixtures = dlg.getData()
 
                 args = Utilities.parseOptionString(consoleCmd)
-                args[0] = Utilities.getExecutablePath(args[0])
+                args[0] = getExecutablePath(args[0])
                 args.append(self.__getPythonExecutable())
                 args.append("manage.py")
                 args.append("testserver")
@@ -3133,7 +3154,7 @@
                 args += fixtures
 
                 with contextlib.suppress(DjangoNoSiteSelectedError):
-                    if Utilities.isWindowsPlatform():
+                    if isWindowsPlatform():
                         serverProcStarted, pid = QProcess.startDetached(
                             args[0], args[1:], self.__sitePath()
                         )
@@ -3188,7 +3209,7 @@
             )
             if ok and userName != "":
                 args = Utilities.parseOptionString(consoleCmd)
-                args[0] = Utilities.getExecutablePath(args[0])
+                args[0] = getExecutablePath(args[0])
                 args.append(self.__getPythonExecutable())
                 args.append("manage.py")
                 args.append("changepassword")
@@ -3213,7 +3234,7 @@
         )[1]
         if consoleCmd:
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(self.__getPythonExecutable())
             args.append("manage.py")
             args.append("createsuperuser")

eric ide

mercurial