Skip to content

Commit

Permalink
Merge pull request #572 from TyberiusPrime/broken-python-requires
Browse files Browse the repository at this point in the history
ignore packages that have broken python_requires definitions
  • Loading branch information
DavHau authored Nov 3, 2023
2 parents 0fb2c80 + e9cea0c commit c7477e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mach_nix/data/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,14 @@ def _get_candidates(self, name) -> dict:
pkg_data = pyvers[pkg_data]
if 'python_requires' in pkg_data:
specs = ",".join(pkg_data['python_requires'])
parsed_py_requires = list(parse_reqs(f"python{specs}"))
try:
parsed_py_requires = list(parse_reqs(f"python{specs}"))
except packaging.specifiers.InvalidSpecifier as e:
print(f"WARNING: `python_requires` attribute of sdist {name}:{ver} could not be parsed. Ignoring package. Exception was {e}")
continue
if not filter_versions([self.py_ver.version], parsed_py_requires[0]):
continue

candidates[ver] = pkg_data
return candidates

Expand Down Expand Up @@ -499,7 +504,7 @@ def all_candidates(self, pkg_name, extras, builds) -> Iterable[Candidate]:
provider_info=ProviderInfo(self, data=pkg)
))
except packaging.version.InvalidVersion:
print(f"Error parsing (sdist) {pkg} version '{ver}")
print(f"Error parsing (sdist) {pkg_name} version '{ver}")
continue
return result

Expand Down

0 comments on commit c7477e7

Please sign in to comment.