Utilities/__init__.py

changeset 1841
2f9e28e56c1b
parent 1839
03b44e1c67e6
child 1914
fa4d57a6c3a9
--- a/Utilities/__init__.py	Sat May 05 14:54:17 2012 +0200
+++ b/Utilities/__init__.py	Sat May 05 15:47:22 2012 +0200
@@ -1362,37 +1362,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
 ################################################################################
@@ -1511,7 +1480,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:
@@ -1520,6 +1496,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