Skip to content

Commit

Permalink
Mark a Python plugin without an __init__.py as broken
Browse files Browse the repository at this point in the history
utils.findPlugins() checks for the existence of an __init__.py which
results in an attempt to enable a plugin without an __init__.py being
blocked with the only notification being a message in the Plugins log:

WARNING    Plugin "<name>" is not compatible with this version of QGIS.
             It will be disabled.

This is not very informative, especially because it is the same message
used for a metadata version mismatch.

Adding this check to Plugins.getInstalledPlugin(), which already
duplicates the metadata checks from utils.findPlugins(), results in the
plugin being marked as broken in the Plugins dialog.
  • Loading branch information
cjmayo committed Aug 30, 2018
1 parent 123f694 commit 051e4d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -600,6 +600,10 @@ def pluginMetadata(fct):
errorDetails = ""
version = None

if not os.path.exists(os.path.join(path, '__init__.py')):
error = "broken"
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Missing __init__.py")

metadataFile = os.path.join(path, 'metadata.txt')
if os.path.exists(metadataFile):
version = normalizeVersion(pluginMetadata("version"))
Expand Down

0 comments on commit 051e4d1

Please sign in to comment.