Skip to content

Commit 60fed67

Browse files
cjmayonyalldawson
authored andcommitted
Mark a Python plugin without an __init__.py as broken
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. (cherry picked from commit 051e4d1)
1 parent f31a7f4 commit 60fed67

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/pyplugin_installer/installer_data.py

+4
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ def pluginMetadata(fct):
600600
errorDetails = ""
601601
version = None
602602

603+
if not os.path.exists(os.path.join(path, '__init__.py')):
604+
error = "broken"
605+
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Missing __init__.py")
606+
603607
metadataFile = os.path.join(path, 'metadata.txt')
604608
if os.path.exists(metadataFile):
605609
version = normalizeVersion(pluginMetadata("version"))

0 commit comments

Comments
 (0)