diff --git a/komodo/lint.py b/komodo/lint.py index 26052df1..28719b5a 100755 --- a/komodo/lint.py +++ b/komodo/lint.py @@ -22,7 +22,6 @@ ["release_name", "maintainers", "dependencies", "versions"], ) - MISSING_PACKAGE = "missing package" MISSING_VERSION = "missing version" MISSING_DEPENDENCY = "missing dependency" @@ -128,10 +127,12 @@ def lint( failed_requirements = dependencies.failed_requirements() if failed_requirements: + package_set = sorted(set(failed_requirements.values())) deps = [ _komodo_error( - err="Failed requirements ", + err="Failed requirements:", depends=[str(r) for r in failed_requirements], + package=", ".join(package_set), ) ] else: @@ -200,6 +201,8 @@ def lint_main(): for err in maintainers + deps + versions: if err.err: print(f"{err.err}") + if err.package: + print(f"{err.package}") if err.depends: print(" " + "\n ".join(err.depends)) diff --git a/komodo/pypi_dependencies.py b/komodo/pypi_dependencies.py index 7870054a..838ef250 100644 --- a/komodo/pypi_dependencies.py +++ b/komodo/pypi_dependencies.py @@ -48,7 +48,7 @@ def __init__( environment["python_full_version"] = python_version environment["python_version"] = ".".join(python_version.split(".")[0:2]) self._satisfied_requirements = set() - self._failed_requirements = set() + self._failed_requirements: Dict[Requirement, str] = {} self._used_packages = set() self._to_install = to_install @@ -74,7 +74,7 @@ def _update_package_sets(self, packages=None): requirements = self._get_requirements(package_name, version) self._used_packages.add(package_name) for r in requirements: - _ = self.satisfied(r) + _ = self.satisfied(r, package_name) def failed_requirements(self, packages=None): self._update_package_sets(packages) @@ -221,6 +221,7 @@ def _satisfied( def satisfied( self, requirement: Requirement, + package_name: str = "", extra=None, ) -> bool: """ @@ -247,9 +248,12 @@ def satisfied( if satisfied: self._satisfied_requirements.add(requirement) else: - self._failed_requirements.add(requirement) + if requirement in self._failed_requirements: + self._failed_requirements[requirement] += f", {package_name}" + else: + self._failed_requirements[requirement] = package_name return satisfied and all( - self.satisfied(transient, extra) + self.satisfied(transient, package_name, extra) for (transients, extra) in transient_requirements for transient in transients )