Merge pull request #15772 from MikeMcQuaid/install_from_api_unsupported_variable

Add/use `HOMEBREW_INSTALL_FROM_API_UNSUPPORTED`
This commit is contained in:
Mike McQuaid 2023-07-27 14:04:37 +01:00 committed by GitHub
commit 954fc88b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -597,6 +597,7 @@ then
# Don't support API at this time for older macOS versions.
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "${HOMEBREW_MACOS_OLDEST_SUPPORTED_NUMERIC}" ]]
then
export HOMEBREW_INSTALL_FROM_API_UNSUPPORTED=1
export HOMEBREW_NO_INSTALL_FROM_API=1
fi
else
@ -674,6 +675,7 @@ fi
# Generic OS or non-default prefix: API not supported.
if [[ (-z "${HOMEBREW_MACOS}" && -z "${HOMEBREW_LINUX}") || "${HOMEBREW_PREFIX}" != "${HOMEBREW_DEFAULT_PREFIX}" ]]
then
export HOMEBREW_INSTALL_FROM_API_UNSUPPORTED=1
export HOMEBREW_NO_INSTALL_FROM_API=1
fi

View File

@ -377,7 +377,8 @@ module Homebrew
!ENV["HOMEBREW_GITHUB_HOSTED_RUNNER"] &&
!ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"]
no_install_from_api_set = Homebrew::EnvConfig.no_install_from_api? &&
!Homebrew::EnvConfig.automatically_set_no_install_from_api?
!Homebrew::EnvConfig.automatically_set_no_install_from_api? &&
!Homebrew::EnvConfig.install_from_api_unsupported?
return if !no_auto_update_set && !no_install_from_api_set && !auto_update_secs_set
ohai "You have set:"

View File

@ -488,5 +488,10 @@ module Homebrew
def automatically_set_no_install_from_api?
ENV["HOMEBREW_AUTOMATICALLY_SET_NO_INSTALL_FROM_API"].present?
end
sig { returns(T::Boolean) }
def install_from_api_unsupported?
ENV["HOMEBREW_INSTALL_FROM_API_UNSUPPORTED"].present?
end
end
end