Skip to content

Commit

Permalink
Suppress invalid versions when parsing in package_index. They will st…
Browse files Browse the repository at this point in the history
…ill be allowed for now as long as DeprecationWarnings aren't treated as errors.
  • Loading branch information
jaraco committed Nov 15, 2021
1 parent aeb641a commit 9fd1c09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setuptools/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
Environment, find_distributions, safe_name, safe_version,
to_filename, Requirement, DEVELOP_DIST, EGG_DIST,
to_filename, Requirement, DEVELOP_DIST, EGG_DIST, parse_version,
)
from distutils import log
from distutils.errors import DistutilsError
Expand Down Expand Up @@ -294,6 +294,14 @@ def __init__(
self.to_scan = []
self.opener = urllib.request.urlopen

def add(self, dist):
# ignore invalid versions
try:
parse_version(dist.version)
except Exception:
return
return super().add(dist)

# FIXME: 'PackageIndex.process_url' is too complex (14)
def process_url(self, url, retrieve=False): # noqa: C901
"""Evaluate a URL as a possible download, and maybe retrieve it"""
Expand Down

0 comments on commit 9fd1c09

Please sign in to comment.