Class: UsesFromMacOSDependency Private
- Inherits:
-
Dependency
- Object
- Dependency
- UsesFromMacOSDependency
- Defined in:
- dependency/uses_from_macos_dependency.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
A dependency that's marked as "installed" on macOS
Constant Summary
Constants included from Dependable
Dependable::KEEP_BUT_PRUNE_RECURSIVE_DEPS, Dependable::PRUNE, Dependable::RESERVED_TAGS, Dependable::SKIP
Instance Attribute Summary collapse
- #bounds ⇒ Hash{Symbol => Symbol} readonly private
Attributes inherited from Dependency
Instance Method Summary collapse
- #dup_with_formula_name(formula) ⇒ T.self_type private
- #initialize(name, tags = [], bounds:) ⇒ void constructor private
- #installed?(minimum_version: nil, minimum_revision: nil, minimum_compatibility_version: nil, bottle_os_version: nil) ⇒ Boolean private
- #use_macos_install?(bottle_os_version: nil) ⇒ Boolean private
- #uses_from_macos? ⇒ Boolean private
Methods inherited from Dependency
action, cache, clear_cache, delete_timestamped_cache_entry, expand, merge_repeats, #missing_options, #option_names, #satisfied?, #to_formula, #to_installed_formula
Methods included from Dependable
#build?, #implicit?, #no_linkage?, #option_names, #option_tags, #optional?, #options, #prune_from_option?, #prune_if_build_and_not_dependent?, #recommended?, #required?, #tags, #test?
Constructor Details
#initialize(name, tags = [], bounds:) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 11 12 13 14 |
# File 'dependency/uses_from_macos_dependency.rb', line 10 def initialize(name, = [], bounds:) super(name, ) @bounds = bounds end |
Instance Attribute Details
#bounds ⇒ Hash{Symbol => Symbol} (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
7 8 9 |
# File 'dependency/uses_from_macos_dependency.rb', line 7 def bounds @bounds end |
Instance Method Details
#dup_with_formula_name(formula) ⇒ T.self_type
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
85 86 87 |
# File 'dependency/uses_from_macos_dependency.rb', line 85 def dup_with_formula_name(formula) self.class.new(formula.full_name.to_s, , bounds:) end |
#installed?(minimum_version: nil, minimum_revision: nil, minimum_compatibility_version: nil, bottle_os_version: nil) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
38 39 40 41 |
# File 'dependency/uses_from_macos_dependency.rb', line 38 def installed?(minimum_version: nil, minimum_revision: nil, minimum_compatibility_version: nil, bottle_os_version: nil) use_macos_install?(bottle_os_version:) || super end |
#use_macos_install?(bottle_os_version: nil) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'dependency/uses_from_macos_dependency.rb', line 44 def use_macos_install?(bottle_os_version: nil) # Check whether macOS is new enough for dependency to not be required. if Homebrew::SimulateSystem.simulating_or_running_on_macos? # If there's no since bound, the dependency is always available from macOS since_os_bounds = bounds[:since] return true if since_os_bounds.blank? # When installing a bottle built on an older macOS version, use that version # to determine if the dependency should come from macOS or Homebrew effective_os = if bottle_os_version.present? && bottle_os_version.start_with?("macOS ") # bottle_os_version is a string like "14" for Sonoma, "15" for Sequoia # Convert it to a MacOS version symbol for comparison MacOSVersion.new(bottle_os_version.delete_prefix("macOS ")) elsif Homebrew::SimulateSystem.current_os == :macos # Assume the oldest macOS version when simulating a generic macOS version # Version::NULL is always treated as less than any other version. Version::NULL else MacOSVersion.from_symbol(Homebrew::SimulateSystem.current_os) end since_os = begin MacOSVersion.from_symbol(since_os_bounds) rescue MacOSVersion::Error # If we can't parse the bound, it means it's an unsupported macOS version # so let's default to the oldest possible macOS version Version::NULL end return true if effective_os >= since_os end false end |
#uses_from_macos? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
80 81 82 |
# File 'dependency/uses_from_macos_dependency.rb', line 80 def uses_from_macos? true end |