search: show results by platform
This means that formulas that are only available on one OS should only show up in the search results for the platform.
This commit is contained in:
parent
140d444462
commit
c073cf901a
@ -6,6 +6,7 @@ class Formula
|
||||
undef loader_path
|
||||
undef deuniversalize_machos
|
||||
undef add_global_deps_to_spec
|
||||
undef valid_platform?
|
||||
|
||||
sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) }
|
||||
def shared_library(name, version = nil)
|
||||
@ -43,4 +44,9 @@ class Formula
|
||||
end
|
||||
@global_deps.each { |dep| spec.dependency_collector.add(dep) }
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def valid_platform?
|
||||
requirements.none?(MacOSRequirement)
|
||||
end
|
||||
end
|
||||
|
||||
11
Library/Homebrew/extend/os/mac/formula.rb
Normal file
11
Library/Homebrew/extend/os/mac/formula.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Formula
|
||||
undef valid_platform?
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def valid_platform?
|
||||
requirements.none?(LinuxRequirement)
|
||||
end
|
||||
end
|
||||
@ -1948,6 +1948,13 @@ class Formula
|
||||
!tap.core_tap?
|
||||
end
|
||||
|
||||
# True if this formula can be installed on this platform
|
||||
# Redefined in extend/os.
|
||||
# @private
|
||||
def valid_platform?
|
||||
requirements.none?(MacOSRequirement) && requirements.none?(LinuxRequirement)
|
||||
end
|
||||
|
||||
# @private
|
||||
def print_tap_action(options = {})
|
||||
return unless tap?
|
||||
|
||||
@ -113,7 +113,7 @@ module Homebrew
|
||||
|
||||
if formula&.any_version_installed?
|
||||
pretty_installed(name)
|
||||
else
|
||||
elsif formula.nil? || formula.valid_platform?
|
||||
name
|
||||
end
|
||||
end.compact
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user