PluginManager/PluginRepositoryDialog.py

branch
maintenance
changeset 6065
fb0a1b8b0f82
parent 6048
82ad8ec9548c
child 6088
b7fdd0db835e
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