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 '-'.

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 14 Jan 2018 12:03:34 +0100
changeset 6064
32a8b51c89da
parent 6063
a58918e394ce
child 6066
4f0d9d659cf5

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 '-'.

PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
--- a/PluginManager/PluginRepositoryDialog.py	Tue Jan 09 19:05:48 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