Class: UsesFromMacOSDependency Private
- Inherits:
-
Dependency
- Object
- Dependency
- UsesFromMacOSDependency
- Defined in:
- 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 ⇒ Object 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.
339 340 341 342 343 |
# File 'dependency.rb', line 339 def initialize(name, = [], bounds:) super(name, ) @bounds = bounds end |
Instance Attribute Details
#bounds ⇒ Object (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.
336 337 338 |
# File 'dependency.rb', line 336 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.
414 415 416 |
# File 'dependency.rb', line 414 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.
367 368 369 370 |
# File 'dependency.rb', line 367 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.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'dependency.rb', line 373 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.
409 410 411 |
# File 'dependency.rb', line 409 def uses_from_macos? true end |