Skip to content

Commit 699e0dc

Browse files
committed
[core] Adjust message when there is no class in the module
Warning only on a module/file without any element in it. Use Debug level for package/folder, so it does not generate messages by default. Provide full-path to ease debugging.
1 parent 9cffabb commit 699e0dc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

meshroom/core/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
100100
and issubclass(plugin, classType)]
101101

102102
if not plugins:
103-
logging.warning(f"No class defined in plugin: {pluginModuleName}")
103+
# Only packages/folders have __path__, single module/file do not have it.
104+
isPackage = hasattr(pluginMod, "__path__")
105+
# Sub-folders/Packages should not raise a warning, so we adjust the verbosity level.
106+
verbosity = logging.DEBUG if isPackage else logging.WARNING
107+
logging.log(verbosity, f"No class defined in plugin: {package.__name__}.{pluginName} ('{pluginMod.__file__}')")
104108

105109
for p in plugins:
106110
p.packageName = packageName

0 commit comments

Comments
 (0)