Skip to content

Commit

Permalink
Use a function to access plugins_metadata_parser global object
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed May 10, 2019
1 parent 0b3043f commit 46a4435
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/pyplugin_installer/plugindependencies.py
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions python/utils.py
Expand Up @@ -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
Expand Down

0 comments on commit 46a4435

Please sign in to comment.