From 917ce0dc1ea7762d45c459b5fe6c115e5e029e36 Mon Sep 17 00:00:00 2001 From: AGiantSquid Date: Wed, 2 Aug 2023 22:49:43 -0700 Subject: [PATCH] fix: directory is not package unless contains metadata file (#7) iter_packages previously considered any directory in a package_path to be a package. This adds a check that the metadata.path is a file before considering the directory to be a package. --- src/monas/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/monas/config.py b/src/monas/config.py index 33f8d10..f98460f 100644 --- a/src/monas/config.py +++ b/src/monas/config.py @@ -90,7 +90,11 @@ def iter_packages(self) -> Iterable[PyPackage]: for p in self.package_paths: for package in p.iterdir(): if package.is_dir(): - yield PyPackage(self, package) + pypackage = PyPackage(self, package) + if not pypackage.metadata.path.is_file(): + # directory has no python metadata file, ignore + continue + yield pypackage pass_config = click.make_pass_decorator(Config, ensure=True)