Decouple IncompatibleCxxStdlibs from its superclass
This exception is never used outside of the CxxStdlib class, so we don't need the Homebrew::InstallationError superclass.
This commit is contained in:
parent
3d26b75847
commit
262a503b6f
@ -3,6 +3,15 @@ require "compilers"
|
|||||||
class CxxStdlib
|
class CxxStdlib
|
||||||
include CompilerConstants
|
include CompilerConstants
|
||||||
|
|
||||||
|
class CompatibilityError < StandardError
|
||||||
|
def initialize(formula, dep, stdlib)
|
||||||
|
super <<-EOS.undent
|
||||||
|
#{formula.name} dependency #{dep.name} was built with a different C++ standard
|
||||||
|
library (#{stdlib.type_string} from #{stdlib.compiler}). This may cause problems at runtime.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.create(type, compiler)
|
def self.create(type, compiler)
|
||||||
if type && ![:libstdcxx, :libcxx].include?(type)
|
if type && ![:libstdcxx, :libcxx].include?(type)
|
||||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
||||||
@ -18,7 +27,7 @@ class CxxStdlib
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
stdlib.check_dependencies(formula, deps)
|
stdlib.check_dependencies(formula, deps)
|
||||||
rescue IncompatibleCxxStdlibs => e
|
rescue CompatibilityError => e
|
||||||
opoo e.message
|
opoo e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -51,7 +60,7 @@ class CxxStdlib
|
|||||||
|
|
||||||
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
|
||||||
if !compatible_with? dep_stdlib
|
if !compatible_with? dep_stdlib
|
||||||
raise IncompatibleCxxStdlibs.new(formula, dep, dep_stdlib, self)
|
raise CompatibilityError.new(formula, dep, dep_stdlib)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -112,15 +112,6 @@ class UnsatisfiedRequirements < Homebrew::InstallationError
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class IncompatibleCxxStdlibs < Homebrew::InstallationError
|
|
||||||
def initialize(f, dep, wrong, right)
|
|
||||||
super f, <<-EOS.undent
|
|
||||||
#{f} dependency #{dep} was built with a different C++ standard
|
|
||||||
library (#{wrong.type_string} from #{wrong.compiler}). This could cause problems at runtime.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class FormulaConflictError < Homebrew::InstallationError
|
class FormulaConflictError < Homebrew::InstallationError
|
||||||
attr_reader :f, :conflicts
|
attr_reader :f, :conflicts
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user