Skip to content

Commit c48adf7

Browse files
authored
ensure analyze_dependency can handle an invalid version (Azure#37268)
1 parent 8e9762d commit c48adf7

File tree

1 file changed

+7
-1
lines changed
  • tools/azure-sdk-tools/pypi_tools

1 file changed

+7
-1
lines changed

tools/azure-sdk-tools/pypi_tools/pypi.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def filter_packages_for_compatibility(self, package_name, version_set):
5555
def get_ordered_versions(self, package_name, filter_by_compatibility=False) -> List[Version]:
5656
project = self.project(package_name)
5757

58-
versions = [Version(package_version) for package_version in project["releases"].keys()]
58+
versions = []
59+
for package_version in project["releases"].keys():
60+
try:
61+
versions.append(Version(package_version))
62+
except packaging.version.InvalidVersion as e:
63+
logging.warn(f"Invalid version {package_version} for package {package_name}")
64+
continue
5965
versions.sort()
6066

6167
if filter_by_compatibility:

0 commit comments

Comments
 (0)