ENV/shared: handle untapped e.g. gcc48 formula.

In this case we need to handle the throwing on an exception when
attempting to initialize the gcc48 Formula object.

This initialization should be unnecessary if the core GCC is already
installed and rescued if not.
This commit is contained in:
Mike McQuaid 2014-04-30 12:38:22 +01:00
parent cf23fd2e14
commit 116c2b06a8

View File

@ -188,16 +188,21 @@ module SharedEnvExtension
def gcc_version_formula(version)
gcc_formula = Formulary.factory("gcc")
gcc_name = 'gcc' + version.delete('.')
gcc_versions_formula = Formulary.factory(gcc_name)
if gcc_formula.opt_prefix.exist?
gcc_formula
elsif gcc_versions_formula.opt_prefix.exist?
return gcc_formula
end
gcc_versions_formula = Formulary.factory(gcc_name) rescue nil
if gcc_versions_formula && gcc_versions_formula.opt_prefix.exist?
gcc_versions_formula
elsif gcc_formula.version.to_s.include?(version)
gcc_formula
else
elsif gcc_versions_formula
gcc_versions_formula
else
Formulary.factory(gcc_name)
end
end