pypi: allow source wheels as resources

Signed-off-by: William Woodruff <william@yossarian.net>
This commit is contained in:
William Woodruff 2024-07-14 11:58:36 -04:00
parent e56fde6584
commit 547e33ccb7
No known key found for this signature in database

View File

@ -73,12 +73,22 @@ module PyPI
return
end
sdist = json["urls"].find { |url| url["packagetype"] == "sdist" }
return if sdist.nil?
dist = json["urls"].find do |url|
url["packagetype"] == "sdist"
end
# If there isn't an sdist, we use the first source wheel.
if dist.nil?
dist = json["urls"].find do |url|
url["filename"].end_with?("-none-any.whl")
end
end
return if dist.nil?
@pypi_info = [
PyPI.normalize_python_package(json["info"]["name"]), sdist["url"],
sdist["digests"]["sha256"], json["info"]["version"]
PyPI.normalize_python_package(json["info"]["name"]), dist["url"],
dist["digests"]["sha256"], json["info"]["version"]
]
end