formula_installer: check has_apple_developer_tools? once

Closes Homebrew/homebrew#43534.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-09-04 21:27:46 +08:00
parent b505c65b78
commit 8830e401a9

View File

@ -162,7 +162,7 @@ class FormulaInstaller
unless ignore_deps? unless ignore_deps?
deps = compute_dependencies deps = compute_dependencies
check_dependencies_bottled(deps) if pour_bottle? check_dependencies_bottled(deps) if pour_bottle? && !MacOS.has_apple_developer_tools?
install_dependencies(deps) install_dependencies(deps)
end end
@ -248,10 +248,7 @@ class FormulaInstaller
# abnormally with a BuildToolsError if one or more don't. # abnormally with a BuildToolsError if one or more don't.
# Only invoked when the user has no developer tools. # Only invoked when the user has no developer tools.
def check_dependencies_bottled(deps) def check_dependencies_bottled(deps)
unbottled = deps.select do |dep, _| unbottled = deps.reject { |dep, _| dep.to_formula.pour_bottle? }
formula = dep.to_formula
!formula.pour_bottle? && !MacOS.has_apple_developer_tools?
end
raise BuildToolsError.new(unbottled) unless unbottled.empty? raise BuildToolsError.new(unbottled) unless unbottled.empty?
end end