Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'. maintenance

Sun, 14 Jan 2018 12:03:34 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 14 Jan 2018 12:03:34 +0100
branch
maintenance
changeset 6065
fb0a1b8b0f82
parent 6061
e0ceb240afa5
child 6067
fda50ed9a790

Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
(grafted from 32a8b51c89da81752ea1944c811fe8a6fe20990b)

PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
diff -r e0ceb240afa5 -r fb0a1b8b0f82 PluginManager/PluginRepositoryDialog.py
--- a/PluginManager/PluginRepositoryDialog.py	Sun Jan 07 17:22:37 2018 +0100
+++ b/PluginManager/PluginRepositoryDialog.py	Sun Jan 14 12:03:34 2018 +0100
@@ -886,15 +886,22 @@
         if not os.path.isfile(os.path.join(downloadPath, pluginFile)):
             continue
         
-        pluginName, pluginVersion = \
-            pluginFile.replace(".zip", "").rsplit("-", 1)
-        pluginVersionList = re.split("[._-]", pluginVersion)
-        for index in range(len(pluginVersionList)):
-            try:
-                pluginVersionList[index] = int(pluginVersionList[index])
-            except ValueError:
-                # use default of 0
-                pluginVersionList[index] = 0
+        try:
+            pluginName, pluginVersion = \
+                pluginFile.replace(".zip", "").rsplit("-", 1)
+            pluginVersionList = re.split("[._-]", pluginVersion)
+            for index in range(len(pluginVersionList)):
+                try:
+                    pluginVersionList[index] = int(pluginVersionList[index])
+                except ValueError:
+                    # use default of 0
+                    pluginVersionList[index] = 0
+        except ValueError:
+            # rsplit() returned just one entry, i.e. file name doesn't contain
+            # version info separated by '-'
+            # => assume version 0.0.0
+            pluginName = pluginFile.replace(".zip", "")
+            pluginVersionList = [0, 0, 0]
         
         if pluginName not in downloads:
             downloads[pluginName] = []

eric ide

mercurial