brew/Library/Homebrew/extend/os/mac/software_spec.rb
Mike McQuaid a867e78f62
uses_from_macos: fix force_homebrew_on_linux behaviour.
Otherwise the dependencies are read incorrectly on Linux when we're
trying to analyse Homebrew.
2020-11-09 15:23:35 +00:00

25 lines
617 B
Ruby

# typed: false
# frozen_string_literal: true
# The Library/Homebrew/extend/os/software_spec.rb conditional logic will need to be more nuanced
# if this file ever includes more than `uses_from_macos`.
class SoftwareSpec
undef uses_from_macos
def uses_from_macos(deps, bounds = {})
@uses_from_macos_elements ||= []
if deps.is_a?(Hash)
bounds = deps.dup
deps = Hash[*bounds.shift]
end
bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) }
if MacOS.version >= bounds[:since]
@uses_from_macos_elements << deps
else
depends_on deps
end
end
end