From fb27b3215f95420d9ba0da07c06488b60ab4e394 Mon Sep 17 00:00:00 2001 From: Mitch Negus Date: Thu, 3 Apr 2025 23:18:13 +0000 Subject: [PATCH] fix: Ensure that repository access is resilient against namespace packages --- src/firewheel/control/repository_db.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/firewheel/control/repository_db.py b/src/firewheel/control/repository_db.py index 3cf1168e..e8fd5cbd 100644 --- a/src/firewheel/control/repository_db.py +++ b/src/firewheel/control/repository_db.py @@ -68,7 +68,12 @@ def list_repositories(self): # Add all model components that have been added via entry points for entry in entry_points(group="firewheel.mc_repo"): - entries.append({"path": entry.load()[0]}) + # Typically `entry` is a `__path__` attribute of a module; this attribute + # is defined as a sequence of strings enumerating the locations where the + # package's submodules will be found + # https://docs.python.org/3/reference/import.html#path-attributes-on-modules + for path in entry.load(): + entries.append({"path": path}) return iter(entries)