No need to cache lookup that is only done once
This commit is contained in:
parent
2bbc98694a
commit
fe0c018a1a
@ -196,15 +196,12 @@ module SharedEnvExtension
|
|||||||
gcc_name = "gcc-#{version}"
|
gcc_name = "gcc-#{version}"
|
||||||
gcc_version_name = "gcc#{version.delete('.')}"
|
gcc_version_name = "gcc#{version.delete('.')}"
|
||||||
|
|
||||||
ivar = "@#{gcc_version_name}_version"
|
|
||||||
return instance_variable_get(ivar) if instance_variable_defined?(ivar)
|
|
||||||
|
|
||||||
gcc_path = HOMEBREW_PREFIX.join "opt/gcc/bin/#{gcc_name}"
|
gcc_path = HOMEBREW_PREFIX.join "opt/gcc/bin/#{gcc_name}"
|
||||||
gcc_formula = Formulary.factory "gcc"
|
gcc_formula = Formulary.factory "gcc"
|
||||||
gcc_versions_path = \
|
gcc_versions_path = \
|
||||||
HOMEBREW_PREFIX.join "opt/#{gcc_version_name}/bin/#{gcc_name}"
|
HOMEBREW_PREFIX.join "opt/#{gcc_version_name}/bin/#{gcc_name}"
|
||||||
|
|
||||||
formula = if gcc_path.exist?
|
if gcc_path.exist?
|
||||||
gcc_formula
|
gcc_formula
|
||||||
elsif gcc_versions_path.exist?
|
elsif gcc_versions_path.exist?
|
||||||
Formulary.factory gcc_version_name
|
Formulary.factory gcc_version_name
|
||||||
@ -215,8 +212,6 @@ module SharedEnvExtension
|
|||||||
else
|
else
|
||||||
gcc_formula
|
gcc_formula
|
||||||
end
|
end
|
||||||
|
|
||||||
instance_variable_set(ivar, formula)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def warn_about_non_apple_gcc(gcc)
|
def warn_about_non_apple_gcc(gcc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user