Class: UsesFromMacOSDependency Private

Inherits:
Dependency show all
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::RESERVED_TAGS

Instance Attribute Summary collapse

Attributes inherited from Dependency

#name, #tap

Attributes included from Dependable

#tags

Instance Method Summary collapse

Methods inherited from Dependency

action, expand, keep_but_prune_recursive_deps, merge_repeats, #missing_options, #option_names, prune, #satisfied?, skip, #to_formula

Methods included from Cachable

#cache, #clear_cache

Methods included from Dependable

#build?, #implicit?, #option_tags, #optional?, #options, #prune_from_option?, #prune_if_build_and_not_dependent?, #recommended?, #required?, #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.

Parameters:



243
244
245
246
247
# File 'dependency.rb', line 243

def initialize(name, tags = [], bounds:)
  super(name, tags)

  @bounds = bounds
end

Instance Attribute Details

#boundsObject (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.



240
241
242
# File 'dependency.rb', line 240

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.

Parameters:

Returns:

  • (T.self_type)


285
286
287
# File 'dependency.rb', line 285

def dup_with_formula_name(formula)
  self.class.new(formula.full_name.to_s, tags, bounds:)
end

#installed?(minimum_version: nil, minimum_revision: 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.

Parameters:

  • minimum_version (Version, nil) (defaults to: nil)
  • minimum_revision (Integer, nil) (defaults to: nil)

Returns:

  • (Boolean)


258
259
260
# File 'dependency.rb', line 258

def installed?(minimum_version: nil, minimum_revision: nil)
  use_macos_install? || super
end

#use_macos_install?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.

Returns:

  • (Boolean)


263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'dependency.rb', line 263

def use_macos_install?
  # Check whether macOS is new enough for dependency to not be required.
  if Homebrew::SimulateSystem.simulating_or_running_on_macos?
    # Assume the oldest macOS version when simulating a generic macOS version
    return true if Homebrew::SimulateSystem.current_os == :macos && !bounds.key?(:since)

    if Homebrew::SimulateSystem.current_os != :macos
      current_os = MacOSVersion.from_symbol(Homebrew::SimulateSystem.current_os)
      since_os = MacOSVersion.from_symbol(bounds[:since]) if bounds.key?(:since)
      return true if current_os >= since_os
    end
  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.

Returns:

  • (Boolean)


280
281
282
# File 'dependency.rb', line 280

def uses_from_macos?
  true
end