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) end while @f.fails_with?(cc)
if cc.nil? if cc.nil?
raise CompilerSelectionError raise CompilerSelectionError.new(@f)
else else
cc.name cc.name
end end

View File

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

View File

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