utils/pypi: ensure Python

Signed-off-by: William Woodruff <william@yossarian.net>
This commit is contained in:
William Woodruff 2023-06-03 23:47:41 -04:00
parent 009ebff85c
commit f8d6dd4b94
No known key found for this signature in database

View File

@ -27,6 +27,8 @@ module PyPI
@name = PyPI.normalize_python_package(match[1]) @name = PyPI.normalize_python_package(match[1])
@version = match[2] @version = match[2]
else else
ensure_formula_installed!("python")
# The URL might be a source distribution hosted somewhere; # The URL might be a source distribution hosted somewhere;
# try and use `pip install -q --no-deps --dry-run --report ...` to get its # try and use `pip install -q --no-deps --dry-run --report ...` to get its
# name and version. # name and version.
@ -64,7 +66,9 @@ module PyPI
@extras = T.must(match[2]).split "," @extras = T.must(match[2]).split ","
end end
# Get name, URL, SHA-256 checksum, and latest version for a given PyPI package. # Get name, URL, SHA-256 checksum, and latest version for a given package.
# This only works for packages from PyPI or from a PyPI URL; packages
# derived from non-PyPI URLs will produce `nil` here.
sig { params(version: T.nilable(T.any(String, Version))).returns(T.nilable(T::Array[String])) } sig { params(version: T.nilable(T.any(String, Version))).returns(T.nilable(T::Array[String])) }
def pypi_info(version: nil) def pypi_info(version: nil)
return @pypi_info if @pypi_info.present? && version.blank? return @pypi_info if @pypi_info.present? && version.blank?