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:



250
251
252
253
254
# File 'dependency.rb', line 250

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.



247
248
249
# File 'dependency.rb', line 247

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)


292
293
294
# File 'dependency.rb', line 292

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)


265
266
267
# File 'dependency.rb', line 265

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)


270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'dependency.rb', line 270

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)


287
288
289
# File 'dependency.rb', line 287

def uses_from_macos?
  true
end