Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Plugin manager] Remove dead code
  • Loading branch information
borysiasty committed Nov 4, 2017
1 parent cfec339 commit a8f4665
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -548,7 +548,7 @@ def removeRepository(self, repo):
del self.repoCache[repo]

# ----------------------------------------- #
def getInstalledPlugin(self, key, path, readOnly, testLoad=False):
def getInstalledPlugin(self, key, path, readOnly):
""" get the metadata of an installed plugin """
def metadataParser(fct):
""" plugin metadata parser reimplemented from qgis.utils
Expand Down Expand Up @@ -602,21 +602,6 @@ def pluginMetadata(fct):
if not isCompatible(Qgis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion):
error = "incompatible"
errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion)
elif testLoad:
# only testLoad if compatible version
try:
pkg = __import__(key)
reload(pkg)
pkg.classFactory(iface)
except Exception as e:
error = "broken"
errorDetails = str(e.args[0])
except SystemExit as e:
error = "broken"
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "The plugin exited with error status: {0}").format(e.args[0])
except:
error = "broken"
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Unknown error")
elif not os.path.exists(metadataFile):
error = "broken"
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Missing metadata file")
Expand Down Expand Up @@ -683,11 +668,8 @@ def pluginMetadata(fct):
return plugin

# ----------------------------------------- #
def getAllInstalled(self, testLoad=False):
""" Build the localCache
Note: Currently testLoad is always disabled in order to speed up QGIS startup.
The related code will be probably removed.
"""
def getAllInstalled(self):
""" Build the localCache """
self.localCache = {}

# reversed list of the plugin paths: first system plugins -> then user plugins -> finally custom path(s)
Expand All @@ -707,10 +689,8 @@ def getAllInstalled(self, testLoad=False):
path = QDir.toNativeSeparators(pluginsPath + "/" + key)
# readOnly = not QFileInfo(pluginsPath).isWritable() # On windows testing the writable status isn't reliable.
readOnly = isTheSystemDir # Assume only the system plugins are not writable.
# only test those not yet loaded. Loaded plugins already proved they're o.k.
# failedToLoad = settings.value("/PythonPlugins/watchDog/" + key) is not None
testLoadThis = testLoad and key not in qgis.utils.plugins
plugin = self.getInstalledPlugin(key, path=path, readOnly=readOnly, testLoad=testLoadThis)
plugin = self.getInstalledPlugin(key, path=path, readOnly=readOnly)
if key in list(self.localCache.keys()) and compareVersions(self.localCache[key]["version_installed"], plugin["version_installed"]) == 1:
# An obsolete plugin in the "user" location is masking a newer one in the "system" location!
self.obsoletePlugins += [key]
Expand Down

0 comments on commit a8f4665

Please sign in to comment.