Merge pull request #10030 from MikeMcQuaid/formula_installer_pour_bottle

formula_installer: refactor pour_bottle?
This commit is contained in:
Mike McQuaid 2020-12-16 15:19:34 +00:00 committed by GitHub
commit 79eeb00d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,8 +152,8 @@ class FormulaInstaller
!formula.bottle_disabled?
end
sig { params(install_bottle_options: { warn: T::Boolean }).returns(T::Boolean) }
def pour_bottle?(install_bottle_options = { warn: false })
sig { params(output_warning: T::Boolean).returns(T::Boolean) }
def pour_bottle?(output_warning: false)
return false if @pour_failed
return false if !formula.bottle_tag? && !formula.local_bottle_path
@ -164,7 +164,7 @@ class FormulaInstaller
return false if formula.bottle_disabled?
unless formula.pour_bottle?
if install_bottle_options[:warn] && formula.pour_bottle_check_unsatisfied_reason
if output_warning && formula.pour_bottle_check_unsatisfied_reason
opoo <<~EOS
Building #{formula.full_name} from source:
#{formula.pour_bottle_check_unsatisfied_reason}
@ -175,7 +175,7 @@ class FormulaInstaller
bottle = formula.bottle_specification
unless bottle.compatible_locations?
if install_bottle_options[:warn]
if output_warning
opoo <<~EOS
Building #{formula.full_name} from source as the bottle needs:
- HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR})
@ -1111,7 +1111,7 @@ class FormulaInstaller
return if only_deps?
if pour_bottle?(warn: true)
if pour_bottle?(output_warning: true)
begin
downloader.fetch
rescue Exception => e # rubocop:disable Lint/RescueException