os/mac/version: remove Yosemite.
It's no longer possible to run Homebrew there. Co-authored-by: Bo Anderson <mail@boanderson.me>
This commit is contained in:
parent
5bc29fa77b
commit
f43e9b6c04
@ -13,6 +13,8 @@ module OS
|
||||
class Version < ::Version
|
||||
extend T::Sig
|
||||
|
||||
# TODO: when removing symbols here, ensure that they are added to
|
||||
# DEPRECATED_MACOS_VERSIONS in MacOSRequirement.
|
||||
SYMBOLS = {
|
||||
monterey: "12",
|
||||
big_sur: "11",
|
||||
@ -21,22 +23,21 @@ module OS
|
||||
high_sierra: "10.13",
|
||||
sierra: "10.12",
|
||||
el_capitan: "10.11",
|
||||
# TODO: remove after 3.5.0 has been shipped and this is implicitly
|
||||
# odisabled and we've cleaned up all tap references.
|
||||
yosemite: "10.10",
|
||||
}.freeze
|
||||
|
||||
# TODO: bump version when new macOS is released or announced
|
||||
# and also update references in docs/Installation.md and
|
||||
# https://github.com/Homebrew/install/blob/HEAD/install.sh
|
||||
MACOS_NEWEST_UNSUPPORTED = "13"
|
||||
private_constant :MACOS_NEWEST_UNSUPPORTED
|
||||
NEWEST_UNSUPPORTED = "13"
|
||||
private_constant :NEWEST_UNSUPPORTED
|
||||
|
||||
# TODO: bump version when new macOS is released and also update
|
||||
# references in docs/Installation.md and
|
||||
# https://github.com/Homebrew/install/blob/HEAD/install.sh
|
||||
MACOS_OLDEST_SUPPORTED = "10.15"
|
||||
private_constant :MACOS_OLDEST_SUPPORTED
|
||||
OLDEST_SUPPORTED = "10.15"
|
||||
private_constant :OLDEST_SUPPORTED
|
||||
|
||||
OLDEST_ALLOWED = "10.11"
|
||||
|
||||
sig { params(version: Symbol).returns(T.attached_class) }
|
||||
def self.from_symbol(version)
|
||||
@ -89,12 +90,12 @@ module OS
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def outdated_release?
|
||||
self < MACOS_OLDEST_SUPPORTED
|
||||
self < OLDEST_SUPPORTED
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def prerelease?
|
||||
self >= MACOS_NEWEST_UNSUPPORTED
|
||||
self >= NEWEST_UNSUPPORTED
|
||||
end
|
||||
|
||||
# For {OS::Mac::Version} compatibility.
|
||||
|
@ -13,15 +13,41 @@ class MacOSRequirement < Requirement
|
||||
|
||||
attr_reader :comparator, :version
|
||||
|
||||
# TODO: when Yosemite is removed here, keep these around as empty arrays so we
|
||||
# can keep the deprecation/disabling code the same.
|
||||
DISABLED_MACOS_VERSIONS = [].freeze
|
||||
DEPRECATED_MACOS_VERSIONS = [
|
||||
:yosemite,
|
||||
].freeze
|
||||
|
||||
def initialize(tags = [], comparator: ">=")
|
||||
@version = if comparator == "==" && tags.first.respond_to?(:map)
|
||||
tags.shift.map { |s| MacOS::Version.from_symbol(s) }
|
||||
else
|
||||
MacOS::Version.from_symbol(tags.shift) unless tags.empty?
|
||||
@version = begin
|
||||
if comparator == "==" && tags.first.respond_to?(:map)
|
||||
tags.first.map { |s| MacOS::Version.from_symbol(s) }
|
||||
else
|
||||
MacOS::Version.from_symbol(tags.first) unless tags.empty?
|
||||
end
|
||||
rescue MacOSVersionError => e
|
||||
if DISABLED_MACOS_VERSIONS.include?(e.version)
|
||||
odisabled "depends_on :macos => :#{e.version}"
|
||||
elsif DEPRECATED_MACOS_VERSIONS.include?(e.version)
|
||||
odeprecated "depends_on :macos => :#{e.version}"
|
||||
else
|
||||
raise
|
||||
end
|
||||
|
||||
# Array of versions: remove the bad ones and try again.
|
||||
if tags.first.respond_to?(:reject)
|
||||
tags = [tags.first.reject { |s| s == e.version }, tags[1..]]
|
||||
retry
|
||||
end
|
||||
|
||||
# Otherwise fallback to the oldest allowed if comparator is >=.
|
||||
MacOS::Version.new(MacOS::Version::OLDEST_ALLOWED) if comparator == ">="
|
||||
end
|
||||
|
||||
@comparator = comparator
|
||||
super(tags)
|
||||
super(tags.drop(1))
|
||||
end
|
||||
|
||||
def version_specified?
|
||||
|
Loading…
x
Reference in New Issue
Block a user