Merge pull request #19244 from gromgit/formula_creator/latest_python

formula_creator: depend on latest python
This commit is contained in:
Mike McQuaid 2025-02-05 13:16:12 +00:00 committed by GitHub
commit b526a0664a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,6 +97,14 @@ module Homebrew
path
end
sig { params(name: String).returns(String) }
def latest_versioned_formula(name)
name_prefix = "#{name}@"
Tap.fetch("homebrew/core").formula_names
.select { |f| f.start_with?(name_prefix) }
.max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python"
end
sig { returns(String) }
def template
# FIXME: https://github.com/errata-ai/vale/issues/818
@ -138,7 +146,7 @@ module Homebrew
<% elsif @mode == :perl %>
uses_from_macos "perl"
<% elsif @mode == :python %>
depends_on "python@x.y"
depends_on "#{latest_versioned_formula("python")}"
<% elsif @mode == :ruby %>
uses_from_macos "ruby"
<% elsif @mode == :rust %>