Make CompilerSelectionError an InstallationError

Fixes Homebrew/homebrew#19962.
This commit is contained in:
Jack Nagel 2013-12-03 22:16:37 -06:00
parent fa5b633650
commit 65a00e213b
3 changed files with 6 additions and 9 deletions

View File

@ -73,7 +73,7 @@ class CompilerSelector
end while @f.fails_with?(cc)
if cc.nil?
raise CompilerSelectionError
raise CompilerSelectionError.new(@f)
else
cc.name
end

View File

@ -218,9 +218,10 @@ end
# raised by CompilerSelector if the formula fails with all of
# the compilers available on the user's system
class CompilerSelectionError < StandardError
def message; <<-EOS.undent
This formula cannot be built with any available compilers.
class CompilerSelectionError < Homebrew::InstallationError
def initialize f
super f, <<-EOS.undent
#{f.name} cannot be built with any available compilers.
To install this formula, you may need to:
brew install apple-gcc42
EOS

View File

@ -116,11 +116,7 @@ module SharedEnvExtension
# If no valid compiler is found, raises an exception.
def validate_cc!(formula)
if formula.fails_with? ENV.compiler
begin
send CompilerSelector.new(formula).compiler
rescue CompilerSelectionError => e
raise e.message
end
send CompilerSelector.new(formula).compiler
end
end