brew/Library/Homebrew/extend/os/mac/software_spec.rb

26 lines
690 B
Ruby
Raw Normal View History

2021-09-11 01:00:23 +01:00
# typed: true
# 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
2021-02-16 09:25:34 +00:00
deps = bounds.shift
end
bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) }
2021-03-03 00:30:40 +00:00
if MacOS.version >= bounds[:since] ||
(Homebrew::EnvConfig.simulate_macos_on_linux? && !bounds.key?(:since))
@uses_from_macos_elements << deps
else
depends_on deps
end
end
end