Merge pull request #8155 from Bo98/pipgrip-defer

utils/pypi: don't require pipgrip unless we are using it
This commit is contained in:
Bo Anderson 2020-07-31 17:49:11 +01:00 committed by GitHub
commit 24249e1f3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,9 +41,6 @@ module PyPI
def update_python_resources!(formula, version = nil, print_only: false, silent: false,
ignore_non_pypi_packages: false)
@pipgrip_installed ||= Formula["pipgrip"].any_version_installed?
odie '"pipgrip" must be installed (`brew install pipgrip`)' unless @pipgrip_installed
# PyPI package name isn't always the same as the formula name. Try to infer from the URL.
pypi_name = if formula.stable.url.start_with?(PYTHONHOSTED_URL_PREFIX)
url_to_pypi_package_name formula.stable.url
@ -66,6 +63,9 @@ module PyPI
odie "\"#{formula.name}\" contains non-PyPI resources. Please update the resources manually."
end
@pipgrip_installed ||= Formula["pipgrip"].any_version_installed?
odie '"pipgrip" must be installed (`brew install pipgrip`)' unless @pipgrip_installed
ohai "Retrieving PyPI dependencies for \"#{pypi_name}==#{version}\"" if !print_only && !silent
pipgrip_output = Utils.popen_read Formula["pipgrip"].bin/"pipgrip", "--json", "--no-cache-dir",
"#{pypi_name}==#{version}"