Added support for pypy. release-2.2.0

Fri, 11 Nov 2016 18:51:53 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 11 Nov 2016 18:51:53 +0100
changeset 91
893e1f0baf23
parent 90
020b73b61327
child 92
3c279cd1808b

Added support for pypy.

ChangeLog file | annotate | diff | comparison | revisions
PluginProjectPyramid.py file | annotate | diff | comparison | revisions
PluginProjectPyramid.zip file | annotate | diff | comparison | revisions
PluginPyramid.e4p file | annotate | diff | comparison | revisions
ProjectPyramid/Project.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Thu Aug 18 16:25:15 2016 +0200
+++ b/ChangeLog	Fri Nov 11 18:51:53 2016 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 2.2.0:
+- added support for pypy
+
 Version 2.1.3:
 - some adjustments to eric changes
 
--- a/PluginProjectPyramid.py	Thu Aug 18 16:25:15 2016 +0200
+++ b/PluginProjectPyramid.py	Fri Nov 11 18:51:53 2016 +0100
@@ -28,7 +28,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.1.3"
+version = "2.2.0"
 className = "ProjectPyramidPlugin"
 packageName = "ProjectPyramid"
 shortDescription = "Project support for Pyramid projects."
@@ -272,16 +272,16 @@
             if loc and loc != "C":
                 locale_dir = os.path.join(
                     os.path.dirname(__file__), "ProjectPyramid", "i18n")
-                translation = "pyramid_%s" % loc
+                translation = "pyramid_{0}".format(loc)
                 translator = QTranslator(None)
                 loaded = translator.load(translation, locale_dir)
                 if loaded:
                     self.__translator = translator
                     e5App().installTranslator(self.__translator)
                 else:
-                    print("Warning: translation file '{0}' could not be"
+                    print("Warning: translation file '{0}' could not be"    # __IGNORE_WARNING__
                           " loaded.".format(translation))
-                    print("Using default.")
+                    print("Using default.")                                 # __IGNORE_WARNING__
     
     def __projectOpened(self):
         """
Binary file PluginProjectPyramid.zip has changed
--- a/PluginPyramid.e4p	Thu Aug 18 16:25:15 2016 +0200
+++ b/PluginPyramid.e4p	Fri Nov 11 18:51:53 2016 +0100
@@ -236,14 +236,6 @@
               <bool>False</bool>
             </value>
             <key>
-              <string>sourceExtensions</string>
-            </key>
-            <value>
-              <list>
-                <string></string>
-              </list>
-            </value>
-            <key>
               <string>useRecursion</string>
             </key>
             <value>
@@ -290,7 +282,7 @@
               <string>ExcludeMessages</string>
             </key>
             <value>
-              <string>E24, E265, N802, N803, N807, N808, N821, W293, E266</string>
+              <string>E24, E265, N802, N803, N807, N808, N821, W293, E266, C101</string>
             </value>
             <key>
               <string>FixCodes</string>
--- a/ProjectPyramid/Project.py	Thu Aug 18 16:25:15 2016 +0200
+++ b/ProjectPyramid/Project.py	Fri Nov 11 18:51:53 2016 +0100
@@ -604,10 +604,9 @@
                 if fullCmd != cmd:
                     variants.append(variant)
             else:
+                fullCmd = self.getPyramidCommand(cmd, variant)
                 if isWindowsPlatform():
-                    debugEnv = self.__getDebugEnvironment(variant)
-                    fullCmd = os.path.join(debugEnv, "Scripts", cmd)
-                    if variant.lower() in fullCmd.lower():
+                    if fullCmd != cmd:
                         variants.append(variant)
                 else:
                     try:
@@ -693,7 +692,14 @@
         if isWindowsPlatform() and not virtualEnv:
             virtualEnv = self.__getDebugEnvironment(language)
         if isWindowsPlatform():
-            cmd = os.path.join(virtualEnv, "Scripts", cmd + '.exe')
+            fullCmds = [
+                os.path.join(virtualEnv, "Scripts", cmd + '.exe'),
+                os.path.join(virtualEnv, "bin", cmd + '.exe'),
+                cmd     # fall back to just cmd
+            ]
+            for cmd in fullCmds:
+                if os.path.exists(cmd):
+                    break
         else:
             fullCmds = [
                 os.path.join(virtualEnv, "bin", cmd),
@@ -713,28 +719,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
     

eric ide

mercurial