@@ -79,22 +79,22 @@ def _find_static_matches(
7979 nssn : PackageNamespaceAndShortName ,
8080 static_reqs : Sequence [StaticRequirement ],
8181 dynamic_reqs : Sequence [DynamicRequirement ],
82- ) -> Iterable [ StaticDependencySolution ]:
83- """When one or more static requirements exists for a package, check that they're the same and return solutions."""
82+ ) -> list [ Candidate ]:
83+ """When one or more static requirements exist for a package, check that they're the same and return solutions."""
8484 for static_req in static_reqs [1 :]:
8585 # We only compare the hash, since future changes in the manifest format might lead to inconsequential
8686 # differences between the 'dependencies' fields.
8787 if static_req .dep .hash != static_reqs [0 ].dep .hash :
8888 # There are multiple _different_ static versions of the dependency required.
89- return ()
89+ return []
9090
9191 # All the static dependencies are equivalent.
9292
9393 if not _do_dynamic_reqs_allow_candidate (dynamic_reqs , static_reqs [0 ].dep .version ):
9494 # At least one dynamic dependency does not allow the static version.
95- return ()
95+ return []
9696
97- return (
97+ return [
9898 StaticDependencySolution (
9999 nssn = nssn ,
100100 owner = static_req .owner ,
@@ -103,12 +103,12 @@ def _find_static_matches(
103103 dependencies = static_req .dep .dependencies ,
104104 )
105105 for static_req in static_reqs
106- )
106+ ]
107107
108108
109109def _find_dynamic_matches (
110110 nssn : PackageNamespaceAndShortName , dynamic_reqs : Sequence [DynamicRequirement ], resolver : DynamicDependencyResolver
111- ) -> Iterator [ DynamicDependencySolution ]:
111+ ) -> list [ Candidate ]:
112112 """When only dynamic requirements exist for a package, find all matching available package versions."""
113113 merged = _merge_dynamic_deps (* (req .dep for req in dynamic_reqs ))
114114
@@ -124,15 +124,15 @@ def _find_dynamic_matches(
124124 reverse = True ,
125125 )
126126
127- return (
127+ return [
128128 DynamicDependencySolution (
129129 nssn = nssn ,
130130 hash = apv .hash ,
131131 version = apv .manifest .version ,
132132 dependencies = apv .manifest .dependencies ,
133133 )
134134 for apv in matching_package_versions
135- )
135+ ]
136136
137137
138138class QPyResolvelibProvider (resolvelib .AbstractProvider [Requirement , Candidate , PackageNamespaceAndShortName ]):
@@ -217,10 +217,15 @@ def find_matches(
217217 return (root_req ,)
218218
219219 if static_reqs :
220- return _find_static_matches (identifier , static_reqs , dynamic_reqs )
220+ matches = _find_static_matches (identifier , static_reqs , dynamic_reqs )
221+ else :
222+ # Only dynamic dependencies for this NSSN have so far been discovered.
223+ matches = _find_dynamic_matches (identifier , dynamic_reqs , self ._dynamic_resolver )
224+
225+ for incompatible_candidate in incompatible_candidates :
226+ matches .remove (incompatible_candidate )
221227
222- # Only dynamic dependencies for this NSSN have so far been discovered.
223- return _find_dynamic_matches (identifier , dynamic_reqs , self ._dynamic_resolver )
228+ return matches
224229
225230 def is_satisfied_by (self , requirement : Requirement , candidate : Candidate ) -> bool :
226231 if isinstance (requirement , StaticRequirement ):
0 commit comments