Skip to content
Permalink
Browse files

Use a function to access plugins_metadata_parser global object

  • Loading branch information
elpaso committed May 10, 2019
1 parent 0b3043f commit 46a4435e6540e943fa89f55f9bfa44e0fa8fc718
Showing with 8 additions and 3 deletions.
  1. +3 −3 python/pyplugin_installer/plugindependencies.py
  2. +5 −0 python/utils.py
@@ -15,7 +15,7 @@
from configparser import NoOptionError, NoSectionError
from .version_compare import compareVersions
from . import installer as plugin_installer
from qgis.utils import updateAvailablePlugins, plugins_metadata_parser
from qgis.utils import updateAvailablePlugins, metadataParser


def __plugin_name_map(plugin_data_values):
@@ -29,7 +29,7 @@ def __get_plugin_deps(plugin_id):
result = {}
updateAvailablePlugins()
try:
parser = plugins_metadata_parser[plugin_id]
parser = metadataParser()[plugin_id]
plugin_deps = parser.get('general', 'plugin_dependencies')
except (NoOptionError, NoSectionError, KeyError):
return result
@@ -68,7 +68,7 @@ def find_dependencies(plugin_id, plugin_data=None, plugin_deps=None, installed_p

if installed_plugins is None:
updateAvailablePlugins()
metadata_parser = plugins_metadata_parser
metadata_parser = metadataParser()
installed_plugins = {metadata_parser[k].get('general', 'name'): metadata_parser[k].get('general', 'version') for k, v in metadata_parser.items()}

if plugin_data is None:
@@ -265,6 +265,11 @@ def findPlugins(path):
yield (pluginName, cp)


def metadataParser():
"""Used by other modules to access the local parser object"""
return plugins_metadata_parser


def updateAvailablePlugins():
""" Go through the plugin_paths list and find out what plugins are available. """
# merge the lists

0 comments on commit 46a4435

Please sign in to comment.
You can’t perform that action at this time.