Merge pull request #8159 from Rylan12/update-python-resources-no-sdist

update-python-resources: handle no sdist for package
This commit is contained in:
Rylan Polster 2020-07-31 20:29:51 -04:00 committed by GitHub
commit aada3f669f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ module PyPI
url
end
# Get name, url, and version for a given pypi package
# Get name, url and sha256 for a given pypi package
def get_pypi_info(package, version)
metadata_url = "https://pypi.org/pypi/#{package}/#{version}/json"
out, _, status = curl_output metadata_url, "--location"
@ -35,6 +35,8 @@ module PyPI
end
sdist = json["urls"].find { |url| url["packagetype"] == "sdist" }
return json["info"]["name"] if sdist.nil?
[json["info"]["name"], sdist["url"], sdist["digests"]["sha256"]]
end