PluginManager/PluginManager.py

branch
maintenance
changeset 6646
51eefa621de4
parent 6645
ad476851d7e0
--- a/PluginManager/PluginManager.py	Sat Dec 01 11:45:24 2018 +0100
+++ b/PluginManager/PluginManager.py	Thu Jan 10 14:22:59 2019 +0100
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2007 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+# Copyright (c) 2007 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
 #
 
 """
@@ -36,6 +36,7 @@
 
 import UI.PixmapCache
 
+import Globals
 import Utilities
 import Preferences
 
@@ -337,6 +338,36 @@
             self.loadPlugin(develPluginName, develPluginPath)
             self.__develPluginName = develPluginName
     
+    def loadDocumentationSetPlugins(self):
+        """
+        Public method to load just the documentation sets plugins.
+        
+        @exception PluginModulesError raised to indicate the absence of
+            plug-in modules
+        """
+        if not self.__pluginModulesExist():
+            raise PluginModulesError
+        
+        self.__insertPluginsPaths()
+        
+        for pluginName in self.__foundGlobalModules:
+            # user and core plug-ins have priority
+            if pluginName not in self.__foundUserModules and \
+               pluginName not in self.__foundCoreModules and \
+               pluginName.startswith("PluginDocumentationSets"):
+                self.loadPlugin(pluginName, self.pluginDirs["global"])
+        
+        for pluginName in self.__foundUserModules:
+            # core plug-ins have priority
+            if pluginName not in self.__foundCoreModules and \
+               pluginName.startswith("PluginDocumentationSets"):
+                self.loadPlugin(pluginName, self.pluginDirs["user"])
+        
+        for pluginName in self.__foundCoreModules:
+            # plug-in under development has priority
+            if pluginName.startswith("PluginDocumentationSets"):
+                self.loadPlugin(pluginName, self.pluginDirs["eric6"])
+    
     def loadPlugin(self, name, directory, reload_=False):
         """
         Public method to load a plugin module.
@@ -1303,13 +1334,11 @@
                 self.__updateAvailable = True
             return
         
-        if version.count(".") >= 3:
-            # cope for extended version numbers by ignoring
-            # the extension
-            checkVersion = ".".join(version.split(".", 3)[:3])
-        else:
-            checkVersion = version
-        if pluginDetails["version"] < checkVersion:
+        versionTuple = Globals.versionToTuple(version)[:3]
+        pluginVersionTuple = Globals.versionToTuple(
+            pluginDetails["version"])[:3]
+        
+        if pluginVersionTuple < versionTuple:
             self.__updateAvailable = True
             return
         
@@ -1317,7 +1346,8 @@
             # Check against downloaded plugin archives
             # 1. Check, if the archive file exists
             if not os.path.exists(archive):
-                self.__updateAvailable = True
+                if pluginDetails["moduleName"] != pluginName:
+                    self.__updateAvailable = True
                 return
             
             # 2. Check, if the archive is a valid zip file
@@ -1330,10 +1360,11 @@
             try:
                 aversion = zipFile.read("VERSION").decode("utf-8")
             except KeyError:
-                aversion = ""
+                aversion = "0.0.0"
             zipFile.close()
             
-            if aversion != version:
+            aversionTuple = Globals.versionToTuple(aversion)[:3]
+            if aversionTuple != versionTuple:
                 self.__updateAvailable = True
     
     def __sslErrors(self, reply, errors):

eric ide

mercurial