Add commented out deprecations for MacOS
when simulating Linux
This commit is contained in:
parent
4efd7cdb28
commit
b7532a86e1
@ -7,6 +7,9 @@ require "os/mac/xcode"
|
|||||||
require "os/mac/sdk"
|
require "os/mac/sdk"
|
||||||
require "os/mac/keg"
|
require "os/mac/keg"
|
||||||
|
|
||||||
|
# TODO: remove this once the `MacOS` module is undefined on Linux
|
||||||
|
require "simulate_system"
|
||||||
|
|
||||||
module OS
|
module OS
|
||||||
# Helper module for querying system information on macOS.
|
# Helper module for querying system information on macOS.
|
||||||
module Mac
|
module Mac
|
||||||
@ -21,6 +24,7 @@ module OS
|
|||||||
# using the standard Ruby Comparable methods.
|
# using the standard Ruby Comparable methods.
|
||||||
sig { returns(MacOSVersion) }
|
sig { returns(MacOSVersion) }
|
||||||
def self.version
|
def self.version
|
||||||
|
# odeprecated "`MacOS.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
@version ||= full_version.strip_patch
|
@version ||= full_version.strip_patch
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -28,6 +32,7 @@ module OS
|
|||||||
# using the standard Ruby Comparable methods.
|
# using the standard Ruby Comparable methods.
|
||||||
sig { returns(MacOSVersion) }
|
sig { returns(MacOSVersion) }
|
||||||
def self.full_version
|
def self.full_version
|
||||||
|
# odeprecated "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
@full_version ||= if ENV["HOMEBREW_FAKE_EL_CAPITAN"] # for Portable Ruby building
|
@full_version ||= if ENV["HOMEBREW_FAKE_EL_CAPITAN"] # for Portable Ruby building
|
||||||
MacOSVersion.new("10.11.6")
|
MacOSVersion.new("10.11.6")
|
||||||
else
|
else
|
||||||
@ -60,6 +65,7 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.languages
|
def self.languages
|
||||||
|
# odeprecated "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
return @languages if @languages
|
return @languages if @languages
|
||||||
|
|
||||||
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
|
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
|
||||||
@ -73,6 +79,7 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.language
|
def self.language
|
||||||
|
# odeprecated "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
languages.first
|
languages.first
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -83,6 +90,7 @@ module OS
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.sdk_root_needed?
|
def self.sdk_root_needed?
|
||||||
|
# odeprecated "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
if MacOS::CLT.installed?
|
if MacOS::CLT.installed?
|
||||||
# If there's no CLT SDK, return false
|
# If there's no CLT SDK, return false
|
||||||
return false unless MacOS::CLT.provides_sdk?
|
return false unless MacOS::CLT.provides_sdk?
|
||||||
@ -131,11 +139,13 @@ module OS
|
|||||||
|
|
||||||
# Returns the path to an SDK or nil, following the rules set by {sdk}.
|
# Returns the path to an SDK or nil, following the rules set by {sdk}.
|
||||||
def self.sdk_path(version = nil)
|
def self.sdk_path(version = nil)
|
||||||
|
# odeprecated "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
s = sdk(version)
|
s = sdk(version)
|
||||||
s&.path
|
s&.path
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sdk_path_if_needed(version = nil)
|
def self.sdk_path_if_needed(version = nil)
|
||||||
|
# odeprecated "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
# Prefer CLT SDK when both Xcode and the CLT are installed.
|
# Prefer CLT SDK when both Xcode and the CLT are installed.
|
||||||
# Expected results:
|
# Expected results:
|
||||||
# 1. On Xcode-only systems, return the Xcode SDK.
|
# 1. On Xcode-only systems, return the Xcode SDK.
|
||||||
|
@ -126,6 +126,7 @@ module OS
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.installed?
|
def self.installed?
|
||||||
|
# odeprecated "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
!prefix.nil?
|
!prefix.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -174,6 +175,7 @@ module OS
|
|||||||
|
|
||||||
sig { returns(::Version) }
|
sig { returns(::Version) }
|
||||||
def self.version
|
def self.version
|
||||||
|
# odeprecated "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
# may return a version string
|
# may return a version string
|
||||||
# that is guessed based on the compiler, so do not
|
# that is guessed based on the compiler, so do not
|
||||||
# use it in order to check if Xcode is installed.
|
# use it in order to check if Xcode is installed.
|
||||||
@ -264,6 +266,7 @@ module OS
|
|||||||
# Returns true even if outdated tools are installed.
|
# Returns true even if outdated tools are installed.
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.installed?
|
def self.installed?
|
||||||
|
# odeprecated "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
!version.null?
|
!version.null?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -397,6 +400,7 @@ module OS
|
|||||||
# version numbers.
|
# version numbers.
|
||||||
sig { returns(::Version) }
|
sig { returns(::Version) }
|
||||||
def self.version
|
def self.version
|
||||||
|
# odeprecated "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
if @version ||= detect_version
|
if @version ||= detect_version
|
||||||
::Version.new @version
|
::Version.new @version
|
||||||
else
|
else
|
||||||
|
@ -11,6 +11,10 @@ module Readall
|
|||||||
class << self
|
class << self
|
||||||
include Cachable
|
include Cachable
|
||||||
|
|
||||||
|
# TODO: remove this once the `MacOS` module is undefined on Linux
|
||||||
|
MACOS_MODULE_REGEX = /\b(MacOS|OS::Mac)(\.|::)\b/.freeze
|
||||||
|
private_constant :MACOS_MODULE_REGEX
|
||||||
|
|
||||||
private :cache
|
private :cache
|
||||||
|
|
||||||
def valid_ruby_syntax?(ruby_files)
|
def valid_ruby_syntax?(ruby_files)
|
||||||
@ -59,7 +63,9 @@ module Readall
|
|||||||
flags: [], ignore_errors: false)
|
flags: [], ignore_errors: false)
|
||||||
readall_formula = readall_formula_class.new(formula_name, file, :stable, tap: tap)
|
readall_formula = readall_formula_class.new(formula_name, file, :stable, tap: tap)
|
||||||
readall_formula.to_hash
|
readall_formula.to_hash
|
||||||
cache[:valid_formulae][file] = if readall_formula.on_system_blocks_exist?
|
# TODO: Remove check for MACOS_MODULE_REGEX once the `MacOS` module is undefined on Linux
|
||||||
|
cache[:valid_formulae][file] = if readall_formula.on_system_blocks_exist? ||
|
||||||
|
formula_contents.match?(MACOS_MODULE_REGEX)
|
||||||
[bottle_tag, *cache[:valid_formulae][file]]
|
[bottle_tag, *cache[:valid_formulae][file]]
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user