PluginPyLint.py

changeset 46
a781953e3703
parent 44
ee702eaaefda
child 48
69c4c0e04bf6
diff -r 0ae4a6726423 -r a781953e3703 PluginPyLint.py
--- a/PluginPyLint.py	Sun Feb 22 12:36:03 2015 +0100
+++ b/PluginPyLint.py	Sat May 23 16:53:15 2015 +0200
@@ -35,7 +35,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "6.0.1"
+version = "6.1.0"
 className = "PyLintPlugin"
 packageName = "PyLint"
 shortDescription = "Show the PyLint dialogs."
@@ -135,47 +135,56 @@
             import _winreg as winreg    # __IGNORE_WARNING__
         
         def getExePath(branch, access, versionStr):
+            exes = []
             try:
                 software = winreg.OpenKey(branch, 'Software', 0, access)
                 python = winreg.OpenKey(software, 'Python', 0, access)
                 pcore = winreg.OpenKey(python, 'PythonCore', 0, access)
                 version = winreg.OpenKey(pcore, versionStr, 0, access)
                 installpath = winreg.QueryValue(version, 'InstallPath')
+                # Look for the batch script variant
                 exe = os.path.join(installpath, 'Scripts', 'pylint.bat')
                 if os.access(exe, os.X_OK):
-                    return exe
-            except WindowsError:        # __IGNORE_WARNING__
-                return None
-            return None
+                    exes.append(exe)
+                # Look for the executable variant
+                exe = os.path.join(installpath, 'Scripts', 'pylint.exe')
+                if os.access(exe, os.X_OK):
+                    exes.append(exe)
+            except (WindowsError, FileNotFoundError):   # __IGNORE_WARNING__
+                pass
+            return exes
         
         for minorVersion in minorVersions:
             versionStr = '{0}.{1}'.format(majorVersion, minorVersion)
-            exePath = getExePath(
+            exePaths = getExePath(
                 winreg.HKEY_CURRENT_USER,
                 winreg.KEY_WOW64_32KEY | winreg.KEY_READ, versionStr)
-                
-            if exePath is not None:
-                executables.add(exePath)
-            exePath = getExePath(
+            if exePaths:
+                for exePath in exePaths:
+                    executables.add(exePath)
+            
+            exePaths = getExePath(
                 winreg.HKEY_LOCAL_MACHINE,
                 winreg.KEY_WOW64_32KEY | winreg.KEY_READ, versionStr)
+            if exePaths:
+                for exePath in exePaths:
+                    executables.add(exePath)
             
             # Even on Intel 64-bit machines it's 'AMD64'
             if platform.machine() == 'AMD64':
-                if exePath is not None:
-                    executables.add(exePath)
-                exePath = getExePath(
+                exePaths = getExePath(
                     winreg.HKEY_CURRENT_USER,
                     winreg.KEY_WOW64_64KEY | winreg.KEY_READ, versionStr)
+                if exePaths:
+                    for exePath in exePaths:
+                        executables.add(exePath)
                 
-                if exePath is not None:
-                    executables.add(exePath)
                 exePath = getExePath(
                     winreg.HKEY_LOCAL_MACHINE,
                     winreg.KEY_WOW64_64KEY | winreg.KEY_READ, versionStr)
-                
-                if exePath is not None:
-                    executables.add(exePath)
+                if exePaths:
+                    for exePath in exePaths:
+                        executables.add(exePath)
     else:
         #
         # Linux, Unix ...

eric ide

mercurial