Changed code to be compatible with latest PyQt4 Windows installers.

Mon, 22 Apr 2013 20:24:58 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 22 Apr 2013 20:24:58 +0200
changeset 2608
01118174a2f5
parent 2587
68cc83a68883
child 2609
b9b8dff8ece9

Changed code to be compatible with latest PyQt4 Windows installers.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Globals.__init__.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Utilities.__init__.html file | annotate | diff | comparison | revisions
Globals/__init__.py file | annotate | diff | comparison | revisions
Preferences/__init__.py file | annotate | diff | comparison | revisions
QScintilla/APIsManager.py file | annotate | diff | comparison | revisions
Toolbox/Startup.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
eric5.py file | annotate | diff | comparison | revisions
install.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Mon Apr 15 19:36:22 2013 +0200
+++ b/APIs/Python3/eric5.api	Mon Apr 22 20:24:58 2013 +0200
@@ -1749,6 +1749,7 @@
 eric5.Globals.configDir?7
 eric5.Globals.findPython2Interpreters?4()
 eric5.Globals.getConfigDir?4()
+eric5.Globals.getPythonModulesDirectory?4()
 eric5.Globals.isLinuxPlatform?4()
 eric5.Globals.isMacPlatform?4()
 eric5.Globals.isWindowsPlatform?4()
@@ -8030,7 +8031,6 @@
 eric5.Utilities.getPercentReplacement?4(code)
 eric5.Utilities.getPercentReplacementHelp?4()
 eric5.Utilities.getPythonLibPath?4()
-eric5.Utilities.getPythonModulesDirectory?4()
 eric5.Utilities.getPythonVersion?4()
 eric5.Utilities.getQtMacBundle?4(toolname)
 eric5.Utilities.getRealName?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Mon Apr 15 19:36:22 2013 +0200
+++ b/Documentation/Help/source.qhp	Mon Apr 22 20:24:58 2013 +0200
@@ -12497,7 +12497,7 @@
       <keyword name="getProjectBrowserFlags" id="getProjectBrowserFlags" ref="eric5.Preferences.__init__.html#getProjectBrowserFlags" />
       <keyword name="getPython" id="getPython" ref="eric5.Preferences.__init__.html#getPython" />
       <keyword name="getPythonLibPath" id="getPythonLibPath" ref="eric5.Utilities.__init__.html#getPythonLibPath" />
-      <keyword name="getPythonModulesDirectory" id="getPythonModulesDirectory" ref="eric5.Utilities.__init__.html#getPythonModulesDirectory" />
+      <keyword name="getPythonModulesDirectory" id="getPythonModulesDirectory" ref="eric5.Globals.__init__.html#getPythonModulesDirectory" />
       <keyword name="getPythonVersion" id="getPythonVersion" ref="eric5.Utilities.__init__.html#getPythonVersion" />
       <keyword name="getQt" id="getQt" ref="eric5.Preferences.__init__.html#getQt" />
       <keyword name="getQt4DocDir" id="getQt4DocDir" ref="eric5.Preferences.__init__.html#getQt4DocDir" />
--- a/Documentation/Source/eric5.Globals.__init__.html	Mon Apr 15 19:36:22 2013 +0200
+++ b/Documentation/Source/eric5.Globals.__init__.html	Mon Apr 22 20:24:58 2013 +0200
@@ -43,6 +43,9 @@
 <td><a href="#getConfigDir">getConfigDir</a></td>
 <td>Module function to get the name of the directory storing the config data.</td>
 </tr><tr>
+<td><a href="#getPythonModulesDirectory">getPythonModulesDirectory</a></td>
+<td>Function to determine the path to Python's modules directory.</td>
+</tr><tr>
 <td><a href="#isLinuxPlatform">isLinuxPlatform</a></td>
 <td>Function to check, if this is a Linux platform.</td>
 </tr><tr>
@@ -96,6 +99,19 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="getPythonModulesDirectory" ID="getPythonModulesDirectory"></a>
+<h2>getPythonModulesDirectory</h2>
+<b>getPythonModulesDirectory</b>(<i></i>)
+<p>
+    Function to determine the path to Python's modules directory.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+path to the Python modules directory (string)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="isLinuxPlatform" ID="isLinuxPlatform"></a>
 <h2>isLinuxPlatform</h2>
 <b>isLinuxPlatform</b>(<i></i>)
--- a/Documentation/Source/eric5.Utilities.__init__.html	Mon Apr 15 19:36:22 2013 +0200
+++ b/Documentation/Source/eric5.Utilities.__init__.html	Mon Apr 22 20:24:58 2013 +0200
@@ -127,9 +127,6 @@
 <td><a href="#getPythonLibPath">getPythonLibPath</a></td>
 <td>Function to determine the path to Python's library.</td>
 </tr><tr>
-<td><a href="#getPythonModulesDirectory">getPythonModulesDirectory</a></td>
-<td>Function to determine the path to Python's modules directory.</td>
-</tr><tr>
 <td><a href="#getPythonVersion">getPythonVersion</a></td>
 <td>Function to get the Python version (major, minor) as an integer value.</td>
 </tr><tr>
@@ -903,19 +900,6 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
-<a NAME="getPythonModulesDirectory" ID="getPythonModulesDirectory"></a>
-<h2>getPythonModulesDirectory</h2>
-<b>getPythonModulesDirectory</b>(<i></i>)
-<p>
-    Function to determine the path to Python's modules directory.
-</p><dl>
-<dt>Returns:</dt>
-<dd>
-path to the Python modules directory (string)
-</dd>
-</dl>
-<div align="right"><a href="#top">Up</a></div>
-<hr /><hr />
 <a NAME="getPythonVersion" ID="getPythonVersion"></a>
 <h2>getPythonVersion</h2>
 <b>getPythonVersion</b>(<i></i>)
--- a/Globals/__init__.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/Globals/__init__.py	Mon Apr 22 20:24:58 2013 +0200
@@ -145,6 +145,16 @@
     configDir = os.path.expanduser(d)
 
 
+def getPythonModulesDirectory():
+    """
+    Function to determine the path to Python's modules directory.
+    
+    @return path to the Python modules directory (string)
+    """
+    import distutils.sysconfig
+    return distutils.sysconfig.get_python_lib(True)
+    
+
 ################################################################################
 ## functions for searching a Python2 interpreter
 ################################################################################
--- a/Preferences/__init__.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/Preferences/__init__.py	Mon Apr 22 20:24:58 2013 +0200
@@ -33,7 +33,7 @@
 from E5Network.E5Ftp import E5FtpProxyType
 
 from Globals import settingsNameOrganization, settingsNameGlobal, settingsNameRecent, \
-    isWindowsPlatform, findPython2Interpreters
+    isWindowsPlatform, findPython2Interpreters, getPythonModulesDirectory
 
 from Project.ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \
     ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \
@@ -2332,8 +2332,8 @@
     if s == "":
         s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
     if s == "" and isWindowsPlatform():
-        from PyQt4 import pyqtconfig
-        transPath = os.path.join(pyqtconfig._pkg_config["pyqt_mod_dir"], "translations")
+        transPath = os.path.join(getPythonModulesDirectory(),
+                                 "PyQt4", "translations")
         if os.path.exists(transPath):
             s = transPath
     return s
--- a/QScintilla/APIsManager.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/QScintilla/APIsManager.py	Mon Apr 22 20:24:58 2013 +0200
@@ -166,8 +166,8 @@
         """
         if self.__apis is not None:
             if Utilities.isWindowsPlatform():
-                from PyQt4 import pyqtconfig
-                qsciPath = os.path.join(pyqtconfig._pkg_config["pyqt_mod_dir"], "qsci")
+                qsciPath = os.path.join(Utilities.getPythonModulesDirectory(),
+                                        "PyQt4", "qsci")
                 if os.path.exists(qsciPath):
                     # it's the installer
                     apidir = os.path.join(qsciPath, "api", self.__lexer.lexer())
--- a/Toolbox/Startup.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/Toolbox/Startup.py	Mon Apr 22 20:24:58 2013 +0200
@@ -131,8 +131,7 @@
     Module function to set the Qt library paths correctly for windows systems.
     """
     if Globals.isWindowsPlatform():
-        from PyQt4 import pyqtconfig
-        libPath = os.path.join(pyqtconfig._pkg_config["pyqt_mod_dir"], "plugins")
+        libPath = os.path.join(Globals.getPythonModulesDirectory(), "PyQt4", "plugins")
         if os.path.exists(libPath):
             libPath = QDir.fromNativeSeparators(libPath)
             libraryPaths = QApplication.libraryPaths()
--- a/Utilities/__init__.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/Utilities/__init__.py	Mon Apr 22 20:24:58 2013 +0200
@@ -44,6 +44,7 @@
 
 from Globals import isWindowsPlatform, isLinuxPlatform, isMacPlatform  # __IGNORE_WARNING__
 from Globals import getConfigDir, setConfigDir  # __IGNORE_WARNING__
+from Globals import getPythonModulesDirectory   # __IGNORE_WARNING__
 # import these methods into the Utilities namespace
 
 from E5Gui.E5Application import e5App
@@ -1196,16 +1197,6 @@
     return QDir.homePath()
     
 
-def getPythonModulesDirectory():
-    """
-    Function to determine the path to Python's modules directory.
-    
-    @return path to the Python modules directory (string)
-    """
-    import distutils.sysconfig
-    return distutils.sysconfig.get_python_lib(True)
-    
-
 def getPythonLibPath():
     """
     Function to determine the path to Python's library.
--- a/changelog	Mon Apr 15 19:36:22 2013 +0200
+++ b/changelog	Mon Apr 22 20:24:58 2013 +0200
@@ -9,6 +9,7 @@
   -- changed the 'import' statements to improve startup behavior
   -- removed the QtHelp dependancy; support is only available,
      if the QtHelp module could be imported
+  -- changed code to be compatible with latest PyQt4 Windows installers
 - Debugger
   -- Variables Viewer
      --- changed the way multi line strings are shown in the value
--- a/eric5.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/eric5.py	Mon Apr 22 20:24:58 2013 +0200
@@ -207,16 +207,13 @@
         splash = SplashScreen()
 
     # modify the executable search path for the PyQt4 installer
-    try:
-        from PyQt4 import pyqtconfig
-        pyqtDataDir = pyqtconfig._pkg_config["pyqt_mod_dir"]
+    if Globals.isWindowsPlatform():
+        pyqtDataDir = os.path.join(Globals.getPythonModulesDirectory(), "PyQt4")
         if os.path.exists(os.path.join(pyqtDataDir, "bin")):
             path = os.path.join(pyqtDataDir, "bin") + os.pathsep + os.environ["PATH"]
         else:
             path = pyqtDataDir + os.pathsep + os.environ["PATH"]
         os.environ["PATH"] = path
-    except (AttributeError, ImportError):
-        pass
     
     pluginFile = None
     noopen = False
--- a/install.py	Mon Apr 15 19:36:22 2013 +0200
+++ b/install.py	Mon Apr 22 20:24:58 2013 +0200
@@ -152,16 +152,16 @@
     modDir = distutils.sysconfig.get_python_lib(True)
     pyModDir = modDir
     
-    try:
-        from PyQt4 import pyqtconfig
-        pyqtDataDir = pyqtconfig._pkg_config["pyqt_mod_dir"]
-        if os.path.exists(os.path.join(pyqtDataDir, "qsci")):
-            # it's the installer
-            qtDataDir = pyqtDataDir
-        else:
-            qtDataDir = pyqtconfig._pkg_config["qt_data_dir"]
-    except (AttributeError, ImportError):
-        qtDataDir = None
+    pyqtDataDir = os.path.join(modDir, "PyQt4")
+    if os.path.exists(os.path.join(pyqtDataDir, "qsci")):
+        # it's the installer
+        qtDataDir = pyqtDataDir
+    else:
+        try:
+            from PyQt4.QtCore import QLibraryInfo
+            qtDataDir = QLibraryInfo.location(QLibraryInfo.DataPath)
+        except ImportError:
+            qtDataDir = None
     if qtDataDir:
         apisDir = os.path.join(qtDataDir, "qsci", "api")
     else:

eric ide

mercurial