Added checks for blacklisted versions of sip, PyQt4 and QScintilla2. 5_0_x

Sun, 05 Sep 2010 13:38:59 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 05 Sep 2010 13:38:59 +0200
branch
5_0_x
changeset 567
5dcea6a6c0d0
parent 566
374af4e0c9d5
child 568
8cd88abbf946

Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.

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.Utilities.__init__.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.install.html file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
eric5-webbrowser.py file | annotate | diff | comparison | revisions
eric5.py file | annotate | diff | comparison | revisions
install.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sun Sep 05 13:38:42 2010 +0200
+++ b/APIs/Python3/eric5.api	Sun Sep 05 13:38:59 2010 +0200
@@ -5622,6 +5622,7 @@
 eric5.Utilities._escape_map?8
 eric5.Utilities._percentReplacementFunc?5(matchobj)
 eric5.Utilities._uescape?8
+eric5.Utilities.checkBlacklistedVersions?4()
 eric5.Utilities.codingBytes_regexps?7
 eric5.Utilities.coding_regexps?7
 eric5.Utilities.compactPath?4(path, width, measure = len)
@@ -6076,6 +6077,7 @@
 eric5.install-i18n.privateInstall?7
 eric5.install-i18n.progName?7
 eric5.install-i18n.usage?4(rcode = 2)
+eric5.install.BlackLists?7
 eric5.install.apisDir?7
 eric5.install.cfg?7
 eric5.install.cleanUp?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sun Sep 05 13:38:42 2010 +0200
+++ b/Documentation/Help/source.qhp	Sun Sep 05 13:38:59 2010 +0200
@@ -2471,6 +2471,7 @@
       <keyword name="CodingError" id="CodingError" ref="eric5.Utilities.__init__.html#CodingError" />
       <keyword name="__showwarning" id="__showwarning" ref="eric5.Utilities.__init__.html#__showwarning" />
       <keyword name="_percentReplacementFunc" id="_percentReplacementFunc" ref="eric5.Utilities.__init__.html#_percentReplacementFunc" />
+      <keyword name="checkBlacklistedVersions" id="checkBlacklistedVersions" ref="eric5.Utilities.__init__.html#checkBlacklistedVersions" />
       <keyword name="compactPath" id="compactPath" ref="eric5.Utilities.__init__.html#compactPath" />
       <keyword name="compile" id="compile" ref="eric5.Utilities.__init__.html#compile" />
       <keyword name="convertLineEnds" id="convertLineEnds" ref="eric5.Utilities.__init__.html#convertLineEnds" />
--- a/Documentation/Source/eric5.Utilities.__init__.html	Sun Sep 05 13:38:42 2010 +0200
+++ b/Documentation/Source/eric5.Utilities.__init__.html	Sun Sep 05 13:38:59 2010 +0200
@@ -44,6 +44,9 @@
 <td><a href="#_percentReplacementFunc">_percentReplacementFunc</a></td>
 <td>Protected function called for replacing % codes.</td>
 </tr><tr>
+<td><a href="#checkBlacklistedVersions">checkBlacklistedVersions</a></td>
+<td>Module functions to check for blacklisted versions of the prerequisites.</td>
+</tr><tr>
 <td><a href="#compactPath">compactPath</a></td>
 <td>Function to return a compacted path fitting inside the given width.</td>
 </tr><tr>
@@ -311,6 +314,19 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="checkBlacklistedVersions" ID="checkBlacklistedVersions"></a>
+<h2>checkBlacklistedVersions</h2>
+<b>checkBlacklistedVersions</b>(<i></i>)
+<p>
+    Module functions to check for blacklisted versions of the prerequisites.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating good versions were found (boolean)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="compactPath" ID="compactPath"></a>
 <h2>compactPath</h2>
 <b>compactPath</b>(<i>path, width, measure = len</i>)
--- a/Documentation/Source/eric5.install.html	Sun Sep 05 13:38:42 2010 +0200
+++ b/Documentation/Source/eric5.install.html	Sun Sep 05 13:38:59 2010 +0200
@@ -26,7 +26,7 @@
 </p>
 <h3>Global Attributes</h3>
 <table>
-<tr><td>apisDir</td></tr><tr><td>cfg</td></tr><tr><td>configLength</td></tr><tr><td>distDir</td></tr><tr><td>doCleanup</td></tr><tr><td>doCompile</td></tr><tr><td>modDir</td></tr><tr><td>platBinDir</td></tr><tr><td>progLanguages</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr>
+<tr><td>BlackLists</td></tr><tr><td>apisDir</td></tr><tr><td>cfg</td></tr><tr><td>configLength</td></tr><tr><td>distDir</td></tr><tr><td>doCleanup</td></tr><tr><td>doCompile</td></tr><tr><td>modDir</td></tr><tr><td>platBinDir</td></tr><tr><td>progLanguages</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr>
 </table>
 <h3>Classes</h3>
 <table>
--- a/Utilities/__init__.py	Sun Sep 05 13:38:42 2010 +0200
+++ b/Utilities/__init__.py	Sun Sep 05 13:38:59 2010 +0200
@@ -1187,6 +1187,58 @@
     
     return infoStr
 
+def checkBlacklistedVersions():
+    """
+    Module functions to check for blacklisted versions of the prerequisites.
+    
+    @return flag indicating good versions were found (boolean)
+    """
+    from install import BlackLists
+    
+    # check version of sip
+    try:
+        import sipconfig
+        sipVersion = sipconfig.Configuration().sip_version_str
+        # always assume, that snapshots are good
+        if "snapshot" not in sipVersion:
+            # check for blacklisted versions
+            for vers in BlackLists["sip"]:
+                if vers == sipVersion:
+                    print('Sorry, sip version {0} is not compatible with eric5.'\
+                          .format(vers))
+                    print('Please install another version.')
+                    return False
+    except ImportError:
+        pass
+    
+    # check version of PyQt
+    from PyQt4.QtCore import PYQT_VERSION_STR
+    pyqtVersion = PYQT_VERSION_STR
+    # always assume, that snapshots are good
+    if "snapshot" not in pyqtVersion:
+        # check for blacklisted versions
+        for vers in BlackLists["PyQt4"]:
+            if vers == pyqtVersion:
+                print('Sorry, PyQt4 version {0} is not compatible with eric5.'\
+                      .format(vers))
+                print('Please install another version.')
+                return False
+    
+    # check version of QScintilla
+    from PyQt4.Qsci import QSCINTILLA_VERSION_STR
+    scintillaVersion = QSCINTILLA_VERSION_STR
+    # always assume, that snapshots are new enough
+    if "snapshot" not in scintillaVersion:
+        # check for blacklisted versions
+        for vers in BlackLists["QScintilla2"]:
+            if vers == scintillaVersion:
+                print('Sorry, QScintilla2 version {0} is not compatible with eric5.'\
+                      .format(vers))
+                print('Please install another version.')
+                return False
+    
+    return True
+
 ################################################################################
 # password handling functions below
 ################################################################################
--- a/eric5-webbrowser.py	Sun Sep 05 13:38:42 2010 +0200
+++ b/eric5-webbrowser.py	Sun Sep 05 13:38:59 2010 +0200
@@ -70,6 +70,10 @@
                                   "file",
                                   "web browser",
                                   options)
+    
+    if not Utilities.checkBlacklistedVersions():
+        sys.exit(100)
+    
     res = Startup.simpleAppStartup(sys.argv,
                                    appinfo,
                                    createMainWidget)
--- a/eric5.py	Sun Sep 05 13:38:42 2010 +0200
+++ b/eric5.py	Sun Sep 05 13:38:59 2010 +0200
@@ -171,6 +171,9 @@
                                   options)
     ddindex = Startup.handleArgs(sys.argv, appinfo)
     
+    if not Utilities.checkBlacklistedVersions():
+        sys.exit(100)
+    
     app = E5Application(sys.argv)
     
     if Preferences.getUI("SingleApplicationMode"):
--- a/install.py	Sun Sep 05 13:38:42 2010 +0200
+++ b/install.py	Sun Sep 05 13:38:59 2010 +0200
@@ -31,6 +31,13 @@
 cfg = {}
 progLanguages = ["Python", "Ruby"]
 
+# Define blacklisted versions of the prerequisites
+BlackLists = {
+    "sip"         : ["4.11"], 
+    "PyQt4"       : ["4.7.5"], 
+    "QScintilla2" : [], 
+}
+
 def exit(rcode = 0):
     """
     Exit the install script.
@@ -568,6 +575,22 @@
         exit(2)
     print("Qt Version: %s" % qVersion())
     
+    # check version of sip
+    try:
+        import sipconfig
+        sipVersion = sipconfig.Configuration().sip_version_str
+        # always assume, that snapshots are new enough
+        if "snapshot" not in sipVersion:
+            # check for blacklisted versions
+            for vers in BlackLists["sip"]:
+                if vers == sipVersion:
+                    print('Sorry, sip version {0} is not compatible with eric5.'\
+                          .format(vers))
+                    print('Please install another version.')
+                    exit(3)
+    except ImportError:
+        pass
+    
     #check version of PyQt
     from PyQt4.QtCore import PYQT_VERSION_STR
     pyqtVersion = PYQT_VERSION_STR
@@ -582,7 +605,14 @@
         if maj < 4 or (maj == 4 and min < 7):
             print('Sorry, you must have PyQt 4.7.0 or higher or' \
                   ' a recent snapshot release.')
-            exit(3)
+            exit(4)
+        # check for blacklisted versions
+        for vers in BlackLists["PyQt4"]:
+            if vers == pyqtVersion:
+                print('Sorry, PyQt4 version {0} is not compatible with eric5.'\
+                      .format(vers))
+                print('Please install another version.')
+                exit(4)
     print("PyQt Version: ", pyqtVersion)
     
     #check version of QScintilla
@@ -599,7 +629,14 @@
         if maj < 2 or (maj == 2 and min < 4):
             print('Sorry, you must have QScintilla 2.4.0 or higher or' \
                   ' a recent snapshot release.')
-            exit(4)
+            exit(5)
+        # check for blacklisted versions
+        for vers in BlackLists["QScintilla2"]:
+            if vers == scintillaVersion:
+                print('Sorry, QScintilla2 version {0} is not compatible with eric5.'\
+                      .format(vers))
+                print('Please install another version.')
+                exit(5)
     print("QScintilla Version: ", QSCINTILLA_VERSION_STR)
     print("All dependencies ok.")
     print()

eric ide

mercurial