development_tools: update type signatures
This commit is contained in:
parent
61a7ffb999
commit
9638e3e8c0
@ -38,19 +38,6 @@ class DevelopmentTools
|
|||||||
installation_instructions
|
installation_instructions
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: This method appears to be unused. Can it be deleted?
|
|
||||||
sig { returns(T.nilable(String)) }
|
|
||||||
def default_cc
|
|
||||||
cc = DevelopmentTools.locate "cc"
|
|
||||||
return if cc.nil?
|
|
||||||
|
|
||||||
begin
|
|
||||||
cc.realpath.basename.to_s
|
|
||||||
rescue
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { returns(Symbol) }
|
sig { returns(Symbol) }
|
||||||
def default_compiler
|
def default_compiler
|
||||||
:clang
|
:clang
|
||||||
@ -126,7 +113,7 @@ class DevelopmentTools
|
|||||||
{
|
{
|
||||||
"os" => ENV["HOMEBREW_SYSTEM"],
|
"os" => ENV["HOMEBREW_SYSTEM"],
|
||||||
"os_version" => OS_VERSION,
|
"os_version" => OS_VERSION,
|
||||||
"cpu_family" => Hardware::CPU.family,
|
"cpu_family" => Hardware::CPU.family.to_s,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
alias generic_build_system_info build_system_info
|
alias generic_build_system_info build_system_info
|
||||||
|
@ -21,11 +21,11 @@ class DevelopmentTools
|
|||||||
:gcc
|
:gcc
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Hash[String, T.untyped]) }
|
sig { returns(T::Hash[String, T.nilable(String)]) }
|
||||||
def build_system_info
|
def build_system_info
|
||||||
generic_build_system_info.merge({
|
generic_build_system_info.merge({
|
||||||
"glibc_version" => OS::Linux::Glibc.version,
|
"glibc_version" => OS::Linux::Glibc.version.to_s.presence,
|
||||||
"oldest_cpu_family" => Hardware.oldest_cpu,
|
"oldest_cpu_family" => Hardware.oldest_cpu.to_s,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -64,7 +64,7 @@ class DevelopmentTools
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Hash[String, T.untyped]) }
|
sig { returns(T::Hash[String, T.nilable(String)]) }
|
||||||
def build_system_info
|
def build_system_info
|
||||||
build_info = {
|
build_info = {
|
||||||
"xcode" => MacOS::Xcode.version.to_s.presence,
|
"xcode" => MacOS::Xcode.version.to_s.presence,
|
||||||
|
@ -4,7 +4,12 @@
|
|||||||
module Hardware
|
module Hardware
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
sig { params(version: T.nilable(Version)).returns(Symbol) }
|
sig { params(version: T.nilable(Version)).returns(Symbol) }
|
||||||
def self.oldest_cpu(version = MacOS.version)
|
def self.oldest_cpu(version = nil)
|
||||||
|
version = if version
|
||||||
|
MacOS::Version.new(version.to_s)
|
||||||
|
else
|
||||||
|
MacOS.version
|
||||||
|
end
|
||||||
if CPU.arch == :arm64
|
if CPU.arch == :arm64
|
||||||
:arm_vortex_tempest
|
:arm_vortex_tempest
|
||||||
# TODO: this cannot be re-enabled until either Rosetta 2 supports AVX
|
# TODO: this cannot be re-enabled until either Rosetta 2 supports AVX
|
||||||
|
@ -11,6 +11,7 @@ module OS
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
sig { returns(Version) }
|
||||||
def system_version
|
def system_version
|
||||||
@system_version ||= begin
|
@system_version ||= begin
|
||||||
version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
|
version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
|
||||||
@ -22,6 +23,7 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(Version) }
|
||||||
def version
|
def version
|
||||||
@version ||= begin
|
@version ||= begin
|
||||||
version = Utils.popen_read(HOMEBREW_PREFIX/"opt/glibc/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
|
version = Utils.popen_read(HOMEBREW_PREFIX/"opt/glibc/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
|
||||||
@ -38,6 +40,7 @@ module OS
|
|||||||
Version.new(ENV.fetch("HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"))
|
Version.new(ENV.fetch("HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def below_minimum_version?
|
def below_minimum_version?
|
||||||
system_version < minimum_version
|
system_version < minimum_version
|
||||||
end
|
end
|
||||||
|
@ -24,16 +24,19 @@ module OS
|
|||||||
|
|
||||||
# This can be compared to numerics, strings, or symbols
|
# This can be compared to numerics, strings, or symbols
|
||||||
# using the standard Ruby Comparable methods.
|
# using the standard Ruby Comparable methods.
|
||||||
|
sig { returns(Version) }
|
||||||
def version
|
def version
|
||||||
@version ||= full_version.strip_patch
|
@version ||= full_version.strip_patch
|
||||||
end
|
end
|
||||||
|
|
||||||
# This can be compared to numerics, strings, or symbols
|
# This can be compared to numerics, strings, or symbols
|
||||||
# using the standard Ruby Comparable methods.
|
# using the standard Ruby Comparable methods.
|
||||||
|
sig { returns(Version) }
|
||||||
def full_version
|
def full_version
|
||||||
@full_version ||= Version.new((ENV["HOMEBREW_MACOS_VERSION"]).chomp)
|
@full_version ||= Version.new((ENV["HOMEBREW_MACOS_VERSION"]).chomp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(version: Version).void }
|
||||||
def full_version=(version)
|
def full_version=(version)
|
||||||
@full_version = Version.new(version.chomp)
|
@full_version = Version.new(version.chomp)
|
||||||
@version = nil
|
@version = nil
|
||||||
|
@ -89,7 +89,7 @@ module OS
|
|||||||
|
|
||||||
# Returns a Pathname object corresponding to Xcode.app's Developer
|
# Returns a Pathname object corresponding to Xcode.app's Developer
|
||||||
# directory or nil if Xcode.app is not installed.
|
# directory or nil if Xcode.app is not installed.
|
||||||
sig { returns(Pathname) }
|
sig { returns(T.nilable(Pathname)) }
|
||||||
def prefix
|
def prefix
|
||||||
@prefix ||=
|
@prefix ||=
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user