Remove unnecessary use of globals in compiler version methods
This commit is contained in:
parent
e23a3492f4
commit
5acaa3374b
@ -39,6 +39,7 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def dev_tools_path
|
def dev_tools_path
|
||||||
@dev_tools_path ||= \
|
@dev_tools_path ||= \
|
||||||
if File.exist? MacOS::CLT::STANDALONE_PKG_PATH and
|
if File.exist? MacOS::CLT::STANDALONE_PKG_PATH and
|
||||||
@ -107,18 +108,17 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def gcc_40_build_version
|
def gcc_40_build_version
|
||||||
@gcc_40_build_version ||= if locate("gcc-4.0")
|
@gcc_40_build_version ||=
|
||||||
`#{locate("gcc-4.0")} --version` =~ /build (\d{4,})/
|
if (path = locate("gcc-4.0"))
|
||||||
$1.to_i
|
%x{#{path} --version}[/build (\d{4,})/, 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias_method :gcc_4_0_build_version, :gcc_40_build_version
|
alias_method :gcc_4_0_build_version, :gcc_40_build_version
|
||||||
|
|
||||||
def gcc_42_build_version
|
def gcc_42_build_version
|
||||||
@gcc_42_build_version ||= if locate("gcc-4.2") \
|
@gcc_42_build_version ||=
|
||||||
and not locate("gcc-4.2").realpath.basename.to_s =~ /^llvm/
|
if (path = locate("gcc-4.2")) && path.realpath.basename.to_s !~ /^llvm/
|
||||||
`#{locate("gcc-4.2")} --version` =~ /build (\d{4,})/
|
%x{#{path} --version}[/build (\d{4,})/, 1].to_i
|
||||||
$1.to_i
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias_method :gcc_build_version, :gcc_42_build_version
|
alias_method :gcc_build_version, :gcc_42_build_version
|
||||||
@ -133,16 +133,16 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def clang_version
|
def clang_version
|
||||||
@clang_version ||= if locate("clang")
|
@clang_version ||=
|
||||||
`#{locate("clang")} --version` =~ /(?:clang|LLVM) version (\d\.\d)/
|
if (path = locate("clang"))
|
||||||
$1
|
%x{#{path} --version}[/(?:clang|LLVM) version (\d\.\d)/, 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def clang_build_version
|
def clang_build_version
|
||||||
@clang_build_version ||= if locate("clang")
|
@clang_build_version ||=
|
||||||
`#{locate("clang")} --version` =~ %r[clang-(\d{2,})]
|
if (path = locate("clang"))
|
||||||
$1.to_i
|
%x{#{path} --version}[%r[clang-(\d{2,})], 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user