diff --git a/CHANGELOG.md b/CHANGELOG.md index e3eae2a..d897152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - Fix: Fix submodule usage detection when installed as an embedded dependency +- Fix: Consider only external calls when detecting plugin path ## [0.4.0] - 2024-1-24 diff --git a/tools/resources.py b/tools/resources.py index aed1932..b77808e 100644 --- a/tools/resources.py +++ b/tools/resources.py @@ -129,13 +129,13 @@ def _is_module_qgis_plugin(module_name: str) -> IsPluginResult: def _plugin_path_dependency() -> str: """Get the path to the plugin package folder. - Goes up the call stack and up the parent packages until package is - recognized as QGIS plugin. + Traverses packages of calling modules bottom up and checks if it is a qgis plugin. """ for frame_info in inspect.stack(): caller_module_name: Optional[str] = frame_info.frame.f_globals.get("__name__") - if caller_module_name is None: + if caller_module_name is None or "qgis_plugin_tools" in caller_module_name: + # We are interested only on calls from outside of qgis_plugin_tools continue for module_name in _iterate_modules(caller_module_name): if is_plugin := _is_module_qgis_plugin(module_name):