Tue, 08 Nov 2016 19:07:42 +0100
Fixed a few issues and added support for pypy.
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 Mon Aug 15 17:50:01 2016 +0200 +++ b/ChangeLog Tue Nov 08 19:07:42 2016 +0100 @@ -1,5 +1,9 @@ ChangeLog --------- +Version 4.1.0: +- some bug fixes +- added support for pypy + Version 4.0.3: - some adjustments to eric changes
--- a/PluginProjectDjango.py Mon Aug 15 17:50:01 2016 +0200 +++ b/PluginProjectDjango.py Tue Nov 08 19:07:42 2016 +0100 @@ -28,7 +28,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "4.0.3" +version = "4.1.0" className = "ProjectDjangoPlugin" packageName = "ProjectDjango" shortDescription = "Project support for Django projects."
--- a/ProjectDjango/Project.py Mon Aug 15 17:50:01 2016 +0200 +++ b/ProjectDjango/Project.py Tue Nov 08 19:07:42 2016 +0100 @@ -16,6 +16,7 @@ import sys import os import re +import shutil from PyQt5.QtCore import QObject, QTimer, QUrl, QFileInfo from PyQt5.QtGui import QDesktopServices @@ -1031,7 +1032,7 @@ else: cmd = self.__getDjangoAdminCommand(variant) if isWindowsPlatform(): - if variant.lower() in cmd.lower(): + if cmd: variants.append(variant) else: try: @@ -1135,13 +1136,23 @@ else: if isWindowsPlatform(): debugEnv = self.__getDebugEnvironment(language) - cmd = os.path.join(debugEnv, "Scripts", "django-admin.py") + for cmd in [ + # standard Python + os.path.join(debugEnv, "Scripts", "django-admin.py"), + # PyPy + os.path.join(debugEnv, "bin", "django-admin.py"), + ]: + if os.path.exists(cmd): + break + else: + cmd = "" else: if language == "Python2": cmds = ["django-admin2.py", "django-admin2", "django-admin.py-2.7", "django-admin.py-2.6"] elif language == "Python3": cmds = ["django-admin3.py", "django-admin3", + "django-admin.py-3.6", "django-admin.py-3.5", "django-admin.py-3.4", "django-admin.py-3.3", "django-admin.py-3.2"] else: @@ -1162,28 +1173,50 @@ @return python command (string) """ language = self.__e5project.getProjectLanguage() - pythonExe = "python" + virtualEnv = self.__getVirtualEnvironment() if isWindowsPlatform(): - pythonExe += ".exe" + pythonExeList = ["python.exe", "pypy.exe"] + if not virtualEnv: + virtualEnv = self.__getDebugEnvironment(language) + for pythonExe in pythonExeList: + for python in [ + os.path.join(virtualEnv, "Scripts", pythonExe), + os.path.join(virtualEnv, "bin", pythonExe), + os.path.join(virtualEnv, pythonExe) + ]: + if os.path.exists(python): + break + else: + python = "" + + if python: + break + else: + python = "" else: if language == "Python3": - pythonExe = "python3" + pythonExeList = ["python3", "pypy3"] elif language == "Python2": - pythonExe = "python2" - virtualEnv = self.__getVirtualEnvironment() - if isWindowsPlatform() and not virtualEnv: - virtualEnv = self.__getDebugEnvironment(language) - if virtualEnv: - if isWindowsPlatform(): - python = os.path.join(virtualEnv, "Scripts", pythonExe) - if not os.path.exists(python): - python = os.path.join(virtualEnv, pythonExe) + pythonExeList = ["python2", "pypy2"] + if not virtualEnv: + pythonExeList.append("pypy") + virtualEnv = self.__getDebugEnvironment(language) + + for pythonExe in pythonExeList: + for python in [ + os.path.join(virtualEnv, "bin", pythonExe), + # omit the version character + os.path.join(virtualEnv, "bin", pythonExe)[:-1], + ]: + if os.path.exists(python): + break + else: + python = "" + + if python: + break else: - python = os.path.join(virtualEnv, "bin", pythonExe) - if not os.path.exists(python): - python = python[:-1] # omit the version character - else: - python = pythonExe + python = "" return python @@ -1199,8 +1232,8 @@ self.tr("About Django"), self.tr( "<p>Django is a high-level Python Web framework that" - " encourages rapid " - "development and clean, pragmatic design.</p>" + " encourages rapid development and clean, pragmatic" + " design.</p>" "<p><table>" "<tr><td>Version:</td><td>{0}</td></tr>" "<tr><td>URL:</td><td><a href=\"{1}\">" @@ -1372,6 +1405,11 @@ """ title = self.tr("Start Django Project") + # remove the project directory if it exists already + ppath = os.path.join(path, projectName) + if os.path.exists(ppath): + shutil.rmtree(ppath, ignore_errors=True) + args = [] if Utilities.isWindowsPlatform(): args.append(self.__getPythonExecutable()) @@ -1445,6 +1483,11 @@ """ title = self.tr("Start Django Application") + # remove the application directory if it exists already + apath = os.path.join(path, applName) + if os.path.exists(apath): + shutil.rmtree(apath, ignore_errors=True) + args = [] if isGlobal: if Utilities.isWindowsPlatform():