Merge pull request #8159 from Rylan12/update-python-resources-no-sdist
update-python-resources: handle no sdist for package
This commit is contained in:
commit
aada3f669f
@ -21,7 +21,7 @@ module PyPI
|
|||||||
url
|
url
|
||||||
end
|
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)
|
def get_pypi_info(package, version)
|
||||||
metadata_url = "https://pypi.org/pypi/#{package}/#{version}/json"
|
metadata_url = "https://pypi.org/pypi/#{package}/#{version}/json"
|
||||||
out, _, status = curl_output metadata_url, "--location"
|
out, _, status = curl_output metadata_url, "--location"
|
||||||
@ -35,6 +35,8 @@ module PyPI
|
|||||||
end
|
end
|
||||||
|
|
||||||
sdist = json["urls"].find { |url| url["packagetype"] == "sdist" }
|
sdist = json["urls"].find { |url| url["packagetype"] == "sdist" }
|
||||||
|
return json["info"]["name"] if sdist.nil?
|
||||||
|
|
||||||
[json["info"]["name"], sdist["url"], sdist["digests"]["sha256"]]
|
[json["info"]["name"], sdist["url"], sdist["digests"]["sha256"]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user