Fixed an issue caused by semver making an incompatible change in version 3.0.0. eric7-maintenance

Sun, 02 Apr 2023 17:57:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 02 Apr 2023 17:57:47 +0200
branch
eric7-maintenance
changeset 9961
50ce8f74d9a5
parent 9950
983c73a7e9b1
child 9962
9a46aa53ecee

Fixed an issue caused by semver making an incompatible change in version 3.0.0.
(grafted from f78a1dc5d0032d650bea42f80cc08b51b63573e8)

src/eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.Globals.__init__.html file | annotate | diff | comparison | revisions
src/eric7/Globals/__init__.py file | annotate | diff | comparison | revisions
--- a/src/eric7/APIs/Python3/eric7.api	Thu Mar 30 08:55:16 2023 +0200
+++ b/src/eric7/APIs/Python3/eric7.api	Sun Apr 02 17:57:47 2023 +0200
@@ -2012,6 +2012,7 @@
 eric7.Globals.toByteArray?4(value)
 eric7.Globals.toDict?4(value)
 eric7.Globals.toList?4(value)
+eric7.Globals.versionIsValid?4(version)
 eric7.Globals.versionToTuple?4(version, length=3)
 eric7.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder.buildDiagram?4()
 eric7.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder.fromDict?4(version, data)
--- a/src/eric7/Documentation/Help/source.qhp	Thu Mar 30 08:55:16 2023 +0200
+++ b/src/eric7/Documentation/Help/source.qhp	Sun Apr 02 17:57:47 2023 +0200
@@ -20252,6 +20252,7 @@
       <keyword name="version" id="version" ref="eric7.Toolbox.Startup.html#version" />
       <keyword name="version" id="version" ref="eric7.eric7_api.html#version" />
       <keyword name="version" id="version" ref="eric7.eric7_doc.html#version" />
+      <keyword name="versionIsValid" id="versionIsValid" ref="eric7.Globals.__init__.html#versionIsValid" />
       <keyword name="versionToTuple" id="versionToTuple" ref="eric7.Globals.__init__.html#versionToTuple" />
       <keyword name="warning" id="warning" ref="eric7.EricWidgets.EricMessageBox.html#warning" />
       <keyword name="weakCryptographicKey (Module)" id="weakCryptographicKey (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.weakCryptographicKey.html" />
--- a/src/eric7/Documentation/Source/eric7.Globals.__init__.html	Thu Mar 30 08:55:16 2023 +0200
+++ b/src/eric7/Documentation/Source/eric7.Globals.__init__.html	Sun Apr 02 17:57:47 2023 +0200
@@ -70,6 +70,10 @@
 <td>Module function to convert a value to a list.</td>
 </tr>
 <tr>
+<td><a href="#versionIsValid">versionIsValid</a></td>
+<td>Function to check, if the given version string is valid.</td>
+</tr>
+<tr>
 <td><a href="#versionToTuple">versionToTuple</a></td>
 <td>Module function to convert a version string into a tuple.</td>
 </tr>
@@ -372,6 +376,35 @@
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 <hr />
+<a NAME="versionIsValid" ID="versionIsValid"></a>
+<h2>versionIsValid</h2>
+<b>versionIsValid</b>(<i>version</i>)
+
+<p>
+    Function to check, if the given version string is valid.
+</p>
+<dl>
+
+<dt><i>version</i> (str)</dt>
+<dd>
+version string
+</dd>
+</dl>
+<dl>
+<dt>Return:</dt>
+<dd>
+flag indicating validity
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+bool
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+<hr />
 <a NAME="versionToTuple" ID="versionToTuple"></a>
 <h2>versionToTuple</h2>
 <b>versionToTuple</b>(<i>version, length=3</i>)
--- a/src/eric7/Globals/__init__.py	Thu Mar 30 08:55:16 2023 +0200
+++ b/src/eric7/Globals/__init__.py	Sun Apr 02 17:57:47 2023 +0200
@@ -98,6 +98,20 @@
 ###############################################################################
 
 
+def versionIsValid(version):
+    """
+    Function to check, if the given version string is valid.
+
+    @param version version string
+    @type str
+    @return flag indicating validity
+    @rtype bool
+    """
+    try:
+        return semver.VersionInfo.is_valid(version)
+    except AttributeError:
+        return semver.VersionInfo.isvalid(version)
+
 def versionToTuple(version, length=3):
     """
     Module function to convert a version string into a tuple.
@@ -121,7 +135,7 @@
         # ensure the version string contains at least three parts
         version += ".0"
 
-    if semver.VersionInfo.isvalid(version):
+    if versionIsValid(version):
         return semver.VersionInfo.parse(version)
     else:
         return semver.VersionInfo(0, 0, 0)

eric ide

mercurial