Project.py: fixed an issue causing QProcess.start() being called with an empty string for the program. release-5.2.4

Sun, 16 Feb 2020 14:37:31 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 16 Feb 2020 14:37:31 +0100
changeset 146
8c42fc23c94c
parent 145
104b14713e9e
child 147
17a08bd37c2b

Project.py: fixed an issue causing QProcess.start() being called with an empty string for the program.

ChangeLog file | annotate | diff | comparison | revisions
PluginProjectDjango.py file | annotate | diff | comparison | revisions
PluginProjectDjango.zip file | annotate | diff | comparison | revisions
ProjectDjango/Project.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Wed Jan 01 11:58:57 2020 +0100
+++ b/ChangeLog	Sun Feb 16 14:37:31 2020 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 5.2.4:
+- bug fixes
+
 Version 5.2.3:
 - bug fixes
 - changes to support changed eric6 menu structure as of eric6 19.06
--- a/PluginProjectDjango.py	Wed Jan 01 11:58:57 2020 +0100
+++ b/PluginProjectDjango.py	Sun Feb 16 14:37:31 2020 +0100
@@ -28,7 +28,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "5.2.3"
+version = "5.2.4"
 className = "ProjectDjangoPlugin"
 packageName = "ProjectDjango"
 shortDescription = "Project support for Django projects."
Binary file PluginProjectDjango.zip has changed
--- a/ProjectDjango/Project.py	Wed Jan 01 11:58:57 2020 +0100
+++ b/ProjectDjango/Project.py	Sun Feb 16 14:37:31 2020 +0100
@@ -1608,18 +1608,19 @@
         args = ['--version']
         ioEncoding = Preferences.getSystem("IOEncoding")
         cmd = self.__getDjangoAdminCommand()
-        if isWindowsPlatform():
-            args.insert(0, cmd)
-            cmd = self.__getPythonExecutable()
-        
-        process = QProcess()
-        process.start(cmd, args)
-        procStarted = process.waitForStarted()
-        if procStarted:
-            finished = process.waitForFinished(30000)
-            if finished and process.exitCode() == 0:
-                output = str(process.readAllStandardOutput(), ioEncoding,
-                             'replace')
+        if cmd:
+            if isWindowsPlatform():
+                args.insert(0, cmd)
+                cmd = self.__getPythonExecutable()
+            
+            process = QProcess()
+            process.start(cmd, args)
+            procStarted = process.waitForStarted()
+            if procStarted:
+                finished = process.waitForFinished(30000)
+                if finished and process.exitCode() == 0:
+                    output = str(process.readAllStandardOutput(), ioEncoding,
+                                 'replace')
                 djangoVersion = output.splitlines()[0].strip()
         
         return djangoVersion
@@ -1884,20 +1885,18 @@
             shutil.rmtree(ppath, ignore_errors=True)
         
         args = []
-        if Utilities.isWindowsPlatform():
-            args.append(self.__getPythonExecutable())
-            args.append(self.__getDjangoAdminCommand())
+        cmd = self.__getDjangoAdminCommand()
+        if cmd:
+            if Utilities.isWindowsPlatform():
+                args.append(self.__getPythonExecutable())
+            args.append(cmd)
         else:
-            cmd = self.__getDjangoAdminCommand()
-            if cmd:
-                args.append(cmd)
-            else:
-                E5MessageBox.critical(
-                    self.__ui,
-                    title,
-                    self.tr("""<p>The <b>django-admin.py</b> script is"""
-                            """ not in the path. Aborting...</p>"""))
-                return False
+            E5MessageBox.critical(
+                self.__ui,
+                title,
+                self.tr("""<p>The <b>django-admin.py</b> script is"""
+                        """ not in the path. Aborting...</p>"""))
+            return False
         
         args.append("startproject")
         args.append(projectName)
@@ -1963,21 +1962,19 @@
         
         args = []
         if isGlobal:
-            if Utilities.isWindowsPlatform():
-                args.append(self.__getPythonExecutable())
-                args.append(self.__getDjangoAdminCommand())
+            cmd = self.__getDjangoAdminCommand()
+            if cmd:
+                if Utilities.isWindowsPlatform():
+                    args.append(self.__getPythonExecutable())
+                args.append(cmd)
             else:
-                cmd = self.__getDjangoAdminCommand()
-                if cmd:
-                    args.append(cmd)
-                else:
-                    E5MessageBox.critical(
-                        self.__ui,
-                        title,
-                        self.tr("""<p>The <b>django-admin.py</b> script"""
-                                """ is not in the path."""
-                                """ Aborting...</p>"""))
-                    return
+                E5MessageBox.critical(
+                    self.__ui,
+                    title,
+                    self.tr("""<p>The <b>django-admin.py</b> script"""
+                            """ is not in the path."""
+                            """ Aborting...</p>"""))
+                return
         else:
             args.append(self.__getPythonExecutable())
             args.append("manage.py")

eric ide

mercurial