Skip to content

Commit

Permalink
Merge pull request #7493 from GauthamGoli/argv-cleanup-26
Browse files Browse the repository at this point in the history
ARGV: Deprecate ARGV.cc and replace with Homebrew.args.cc
  • Loading branch information
MikeMcQuaid authored May 23, 2020
2 parents 4e67b21 + e5d15c8 commit 1836702
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
4 changes: 0 additions & 4 deletions Library/Homebrew/extend/ARGV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def debug?
flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil?
end

def cc
value "cc"
end

def env
value "env"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/ENV/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def fcflags
# ENV.append_to_cflags "-I ./missing/includes"
# end</pre>
def compiler
@compiler ||= if (cc = ARGV.cc)
@compiler ||= if (cc = Homebrew.args.cc)
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
fetch_compiler(cc, "--cc")
elsif (cc = homebrew_cc)
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def pour_bottle?(install_bottle_options = { warn: false })
return false if !formula.bottled? && !formula.local_bottle_path
return true if force_bottle?
return false if build_from_source? || build_bottle? || interactive?
return false if ARGV.cc
return false if Homebrew.args.cc
return false unless options.empty?
return false if formula.bottle_disabled?

Expand Down Expand Up @@ -729,7 +729,7 @@ def sanitized_argv_options
args << "--interactive" if interactive?
args << "--verbose" if verbose?
args << "--debug" if debug?
args << "--cc=#{ARGV.cc}" if ARGV.cc
args << "--cc=#{Homebrew.args.cc}" if Homebrew.args.cc
args << "--keep-tmp" if Homebrew.args.keep_tmp?

if ARGV.env
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def attempt_directory_creation
end

def check_cc_argv
return unless ARGV.cc
return unless Homebrew.args.cc

@checks ||= Diagnostic::Checks.new
opoo <<~EOS
You passed `--cc=#{ARGV.cc}`.
You passed `--cc=#{Homebrew.args.cc}`.
#{@checks.please_create_pull_requests}
EOS
end
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/test/formula_installer_bottle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "formula_installer"
require "keg"
require "tab"
require "cmd/install"
require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle"

Expand Down Expand Up @@ -49,7 +50,7 @@ def temporarily_install_bottle(formula)

specify "basic bottle install" do
allow(DevelopmentTools).to receive(:installed?).and_return(false)

Homebrew.install_args.parse("testball_bottle")
temporarily_install_bottle(TestballBottle.new) do |f|
# Copied directly from formula_installer_spec.rb
# as we expect the same behavior.
Expand Down
8 changes: 3 additions & 5 deletions Library/Homebrew/test/formula_installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "formula_installer"
require "keg"
require "tab"
require "cmd/install"
require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle"
require "test/support/fixtures/failball"
Expand Down Expand Up @@ -90,11 +91,8 @@ def temporary_install(formula)
end

specify "Formula is not poured from bottle when compiler specified" do
expect(ARGV.cc).to be nil

cc_arg = "--cc=clang"
ARGV << cc_arg

expect(Homebrew.args.cc).to be nil
Homebrew.install_args.parse(["--cc=clang", "testball_bottle"])
temporary_install(TestballBottle.new) do |f|
tab = Tab.for_formula(f)
expect(tab.compiler).to eq("clang")
Expand Down

0 comments on commit 1836702

Please sign in to comment.