Remove ARGV.filter_for_dependencies
This commit is contained in:
parent
10fda9e9b9
commit
445dd80e44
@ -161,15 +161,6 @@ module HomebrewArgvExtension
|
|||||||
Homebrew.help_s
|
Homebrew.help_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_for_dependencies
|
|
||||||
old_args = clone
|
|
||||||
delete "--devel"
|
|
||||||
delete "--HEAD"
|
|
||||||
yield
|
|
||||||
ensure
|
|
||||||
replace(old_args)
|
|
||||||
end
|
|
||||||
|
|
||||||
def cc
|
def cc
|
||||||
value 'cc'
|
value 'cc'
|
||||||
end
|
end
|
||||||
|
|||||||
@ -255,26 +255,24 @@ class FormulaInstaller
|
|||||||
|
|
||||||
while f = formulae.pop
|
while f = formulae.pop
|
||||||
|
|
||||||
ARGV.filter_for_dependencies do
|
f.recursive_requirements do |dependent, req|
|
||||||
f.recursive_requirements do |dependent, req|
|
build = effective_build_options_for(dependent)
|
||||||
build = effective_build_options_for(dependent)
|
|
||||||
|
|
||||||
if (req.optional? || req.recommended?) && build.without?(req)
|
if (req.optional? || req.recommended?) && build.without?(req)
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
elsif req.build? && dependent == f && pour_bottle?
|
elsif req.build? && dependent == f && pour_bottle?
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
elsif req.build? && dependent != f && install_bottle_for_dep?(dependent, build)
|
elsif req.build? && dependent != f && install_bottle_for_dep?(dependent, build)
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
elsif req.satisfied?
|
elsif req.satisfied?
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
elsif req.default_formula?
|
elsif req.default_formula?
|
||||||
dep = req.to_dependency
|
dep = req.to_dependency
|
||||||
deps.unshift(dep)
|
deps.unshift(dep)
|
||||||
formulae.unshift(dep.to_formula)
|
formulae.unshift(dep.to_formula)
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
else
|
else
|
||||||
unsatisfied_reqs[dependent] << req
|
unsatisfied_reqs[dependent] << req
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -285,23 +283,21 @@ class FormulaInstaller
|
|||||||
def expand_dependencies(deps)
|
def expand_dependencies(deps)
|
||||||
inherited_options = {}
|
inherited_options = {}
|
||||||
|
|
||||||
expanded_deps = ARGV.filter_for_dependencies do
|
expanded_deps = Dependency.expand(f, deps) do |dependent, dep|
|
||||||
Dependency.expand(f, deps) do |dependent, dep|
|
options = inherited_options[dep.name] = inherited_options_for(dep)
|
||||||
options = inherited_options[dep.name] = inherited_options_for(dep)
|
build = effective_build_options_for(
|
||||||
build = effective_build_options_for(
|
dependent,
|
||||||
dependent,
|
inherited_options.fetch(dependent.name, [])
|
||||||
inherited_options.fetch(dependent.name, [])
|
)
|
||||||
)
|
|
||||||
|
|
||||||
if (dep.optional? || dep.recommended?) && build.without?(dep)
|
if (dep.optional? || dep.recommended?) && build.without?(dep)
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
elsif dep.build? && dependent == f && pour_bottle?
|
elsif dep.build? && dependent == f && pour_bottle?
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
elsif dep.build? && dependent != f && install_bottle_for_dep?(dependent, build)
|
elsif dep.build? && dependent != f && install_bottle_for_dep?(dependent, build)
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
elsif dep.satisfied?(options)
|
elsif dep.satisfied?(options)
|
||||||
Dependency.skip
|
Dependency.skip
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -333,9 +329,7 @@ class FormulaInstaller
|
|||||||
oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
|
oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
|
||||||
end
|
end
|
||||||
|
|
||||||
ARGV.filter_for_dependencies do
|
deps.each { |dep, options| install_dependency(dep, options) }
|
||||||
deps.each { |dep, options| install_dependency(dep, options) }
|
|
||||||
end
|
|
||||||
|
|
||||||
@show_header = true unless deps.empty?
|
@show_header = true unless deps.empty?
|
||||||
end
|
end
|
||||||
|
|||||||
@ -47,21 +47,4 @@ class ArgvExtensionTests < Homebrew::TestCase
|
|||||||
assert !@argv.flag?("--frotz")
|
assert !@argv.flag?("--frotz")
|
||||||
assert !@argv.flag?("--debug")
|
assert !@argv.flag?("--debug")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_filter_for_dependencies_clears_flags
|
|
||||||
@argv << "--HEAD" << "--devel"
|
|
||||||
@argv.filter_for_dependencies { assert_empty @argv }
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_filter_for_dependencies_ensures_argv_restored
|
|
||||||
@argv.expects(:replace).with(@argv.clone)
|
|
||||||
begin
|
|
||||||
@argv.filter_for_dependencies { raise Exception }
|
|
||||||
rescue Exception
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_filter_for_dependencies_returns_block_value
|
|
||||||
assert_equal 1, @argv.filter_for_dependencies { 1 }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user