diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index 9a2cf29459..a73aa184ef 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -4,3 +4,4 @@ require "compat/cask/dsl/version" require "compat/language/python" require "compat/requirements/macos_requirement" require "compat/formula" +require "compat/os/mac" if OS.mac? diff --git a/Library/Homebrew/compat/os/mac.rb b/Library/Homebrew/compat/os/mac.rb new file mode 100644 index 0000000000..af3863c86a --- /dev/null +++ b/Library/Homebrew/compat/os/mac.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OS + module Mac + class << self + module Compat + def preferred_arch + # odeprecated "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)" + if Hardware::CPU.is_64_bit? + Hardware::CPU.arch_64_bit + else + Hardware::CPU.arch_32_bit + end + end + + def tcc_db + # odeprecated "MacOS.tcc_db" + @tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db") + end + + def pre_mavericks_accessibility_dotfile + # odeprecated "MacOS.pre_mavericks_accessibility_dotfile" + @pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled") + end + end + + prepend Compat + end + end +end diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 5343d7def4..3118edf50f 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -166,14 +166,6 @@ module OS paths.uniq end - def preferred_arch - if Hardware::CPU.is_64_bit? - Hardware::CPU.arch_64_bit - else - Hardware::CPU.arch_32_bit - end - end - def app_with_bundle_id(*ids) path = mdfind(*ids) .reject { |p| p.include?("/Backups.backupdb/") } @@ -196,13 +188,5 @@ module OS def mdfind_query(*ids) ids.map! { |id| "kMDItemCFBundleIdentifier == #{id}" }.join(" || ") end - - def tcc_db - @tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db") - end - - def pre_mavericks_accessibility_dotfile - @pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled") - end end end