Handle multiple nixpkg matching versions arbitrarily.

This commit is contained in:
Tom Prince 2021-10-12 11:22:18 -06:00
parent d223656fc0
commit 8a70284c08

View file

@ -78,13 +78,17 @@ class NixpkgsIndex(UserDict):
if len(same_ver) == 1:
return same_ver[0].nix_key
elif len(same_ver) == 0:
highest = self.get_highest_ver(remaining_pkgs).nix_key
print(f'Multiple nixpkgs attributes found for {name}-{ver}: {[p.nix_key for p in remaining_pkgs]}'
f"\nPicking '{highest}' as base attribute name.")
return highest
# If there are no versions that match at this precision
# we pick the best version among the version that matched
# at the prior prefix.
break
remaining_pkgs = same_ver
# In any case we should have returned by now
raise Exception("Dude... Check yor code!")
# We've either fallen off the loop (in which case the versions match)
# or all remaining packages match the same length version prefix.
highest = self.get_highest_ver(remaining_pkgs).nix_key
print(f'Multiple nixpkgs attributes found for {name}-{ver}: {[p.nix_key for p in remaining_pkgs]}'
f"\nPicking '{highest}' as base attribute name.")
return highest
def exists(self, name, ver=None):
try: