Change algo for determining the path of PySide tools on Windows to check for the Python3 variant first. 5_2_x

Sat, 05 May 2012 15:47:22 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 05 May 2012 15:47:22 +0200
branch
5_2_x
changeset 1842
4113dcd158eb
parent 1840
7c1e74e196a9
child 1846
75d9128748dc

Change algo for determining the path of PySide tools on Windows to check for the Python3 variant first.

Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/Utilities/__init__.py	Sat May 05 14:54:17 2012 +0200
+++ b/Utilities/__init__.py	Sat May 05 15:47:22 2012 +0200
@@ -1334,37 +1334,6 @@
     configDir = os.path.expanduser(d)
 
 
-def checkPyside():
-    """
-    Module function to check the presence of PySide.
-    
-    @return flag indicating the presence of PySide (boolean)
-    """
-    try:
-        # step 1: try Python3 variant of PySide
-        import PySide       # __IGNORE_EXCEPTION__
-        del PySide
-        return True
-    except ImportError:
-        # step 2: check for a Python2 variant
-        interpreter = Preferences.getDebugger("PythonInterpreter")
-        if interpreter == "" or not isinpath(interpreter):
-            return False
-        
-        checker = os.path.join(getConfig('ericDir'),
-                               "UtilitiesPython2", "PySideImporter.py")
-        args = [checker]
-        proc = QProcess()
-        proc.setProcessChannelMode(QProcess.MergedChannels)
-        proc.start(interpreter, args)
-        finished = proc.waitForFinished(30000)
-        if finished:
-            if proc.exitCode() == 0:
-                return True
-    
-    return False
-
-
 ################################################################################
 # functions for environment handling
 ################################################################################
@@ -1483,7 +1452,14 @@
     @return the PySide tool path with extension (string)
     """
     if isWindowsPlatform():
-        prefix = os.path.dirname(Preferences.getDebugger("PythonInterpreter"))
+        try:
+            # step 1: try Python3 variant of PySide
+            import PySide       # __IGNORE_EXCEPTION__
+            del PySide
+            prefix = sys.prefix
+        except ImportError:
+            # step 2: check for a Python2 variant
+            prefix = os.path.dirname(Preferences.getDebugger("PythonInterpreter"))
         if toolname == "pyside-uic":
             return os.path.join(prefix, "Scripts", toolname + '.exe')
         else:
@@ -1492,6 +1468,37 @@
     else:
         return toolname
 
+
+def checkPyside():
+    """
+    Module function to check the presence of PySide.
+    
+    @return flag indicating the presence of PySide (boolean)
+    """
+    try:
+        # step 1: try Python3 variant of PySide
+        import PySide       # __IGNORE_EXCEPTION__
+        del PySide
+        return True
+    except ImportError:
+        # step 2: check for a Python2 variant
+        interpreter = Preferences.getDebugger("PythonInterpreter")
+        if interpreter == "" or not isinpath(interpreter):
+            return False
+        
+        checker = os.path.join(getConfig('ericDir'),
+                               "UtilitiesPython2", "PySideImporter.py")
+        args = [checker]
+        proc = QProcess()
+        proc.setProcessChannelMode(QProcess.MergedChannels)
+        proc.start(interpreter, args)
+        finished = proc.waitForFinished(30000)
+        if finished:
+            if proc.exitCode() == 0:
+                return True
+    
+    return False
+
 ################################################################################
 # Other utility functions below
 ################################################################################

eric ide

mercurial