Modified interpreter selection for PySide detection. Py2 comp.

Thu, 30 May 2013 15:33:23 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Thu, 30 May 2013 15:33:23 +0200
branch
Py2 comp.
changeset 2679
122a9ffdeefb
parent 2678
6e40469b845b
child 2680
110ac646a3a0

Modified interpreter selection for PySide detection.

Utilities/PySideImporter.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
UtilitiesPython2/PySideImporter.py file | annotate | diff | comparison | revisions
eric5.e4p file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utilities/PySideImporter.py	Thu May 30 15:33:23 2013 +0200
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2011 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module to check for the presence of PySide by importing it.
+"""
+
+import sys
+
+if __name__ == "__main__":
+    try:
+        import PySide       # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
+        ret = 0
+    except ImportError:
+        ret = 1
+    
+    sys.exit(ret)
+    
+#
+# eflag: FileType = Python2
--- a/Utilities/__init__.py	Thu May 30 14:48:05 2013 +0200
+++ b/Utilities/__init__.py	Thu May 30 15:33:23 2013 +0200
@@ -1365,13 +1365,16 @@
     """
     if isWindowsPlatform():
         try:
-            # step 1: try Python3 variant of PySide
+            # step 1: try internal Python 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"))
+            # step 2: check for a external Python variant
+            if sys.version_info[0] == 2:
+                prefix = os.path.dirname(Preferences.getDebugger("Python3Interpreter"))
+            else:
+                prefix = os.path.dirname(Preferences.getDebugger("PythonInterpreter"))
         if toolname == "pyside-uic":
             return os.path.join(prefix, "Scripts", toolname + '.exe')
         else:
@@ -1390,21 +1393,24 @@
     """
 
     try:
-        # step 1: try Python3 variant of PySide
+        # step 1: try internal Python variant of PySide
         import PySide       # __IGNORE_EXCEPTION__
         del PySide
-        py3 = True
+        int_py = True
     except ImportError:
-        py3 = False
+        int_py = False
     
-    # step 2: check for a Python2 variant
-    interpreter = Preferences.getDebugger("PythonInterpreter")
+    # step 2: check for a external Python variant
+    if sys.version_info[0] == 2:
+        interpreter = Preferences.getDebugger("Python3Interpreter")
+    else:
+        interpreter = Preferences.getDebugger("PythonInterpreter")
     if interpreter == "" or not isinpath(interpreter):
-        py2 = False
+        ext_py = False
     else:
-        py2 = False
+        ext_py = False
         checker = os.path.join(getConfig('ericDir'),
-                               "UtilitiesPython2", "PySideImporter.py")
+                               "Utilities", "PySideImporter.py")
         args = [checker]
         proc = QProcess()
         proc.setProcessChannelMode(QProcess.MergedChannels)
@@ -1412,9 +1418,12 @@
         finished = proc.waitForFinished(30000)
         if finished:
             if proc.exitCode() == 0:
-                py2 = True
+                ext_py = True
     
-    return py2, py3
+    if sys.version_info[0] == 2:
+        return int_py, ext_py
+    else:
+        return ext_py, int_py
 
 ################################################################################
 # Other utility functions below
--- a/UtilitiesPython2/PySideImporter.py	Thu May 30 14:48:05 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2011 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module to check for the presence of PySide by importing it.
-"""
-
-import sys
-
-if __name__ == "__main__":
-    try:
-        import PySide       # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
-        ret = 0
-    except ImportError:
-        ret = 1
-    
-    sys.exit(ret)
-    
-#
-# eflag: FileType = Python2
--- a/eric5.e4p	Thu May 30 14:48:05 2013 +0200
+++ b/eric5.e4p	Thu May 30 15:33:23 2013 +0200
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE Project SYSTEM "Project-5.1.dtd">
 <!-- eric5 project file for project eric5 -->
+<!-- Saved: 2013-05-30, 15:24:48 -->
+<!-- Copyright (C) 2013 Detlev Offenbach, detlev@die-offenbachs.de -->
 <Project version="5.1">
   <Language>en_US</Language>
   <ProjectWordList>Dictionaries/words.dic</ProjectWordList>
@@ -898,7 +900,6 @@
     <Source>Utilities/crypto/py3AES.py</Source>
     <Source>Utilities/crypto/py3PBKDF2.py</Source>
     <Source>Preferences/ConfigurationPages/SecurityPage.py</Source>
-    <Source>UtilitiesPython2/PySideImporter.py</Source>
     <Source>Plugins/VcsPlugins/vcsMercurial/HgClient.py</Source>
     <Source>Plugins/VcsPlugins/vcsMercurial/HgMultiRevisionSelectionDialog.py</Source>
     <Source>Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py</Source>
@@ -1076,6 +1077,7 @@
     <Source>Examples/modpython.py</Source>
     <Source>Examples/modpython_dbg.py</Source>
     <Source>Examples/rhallo.py</Source>
+    <Source>Utilities/PySideImporter.py</Source>
   </Sources>
   <Forms>
     <Form>PyUnit/UnittestDialog.ui</Form>

eric ide

mercurial