Prefer newer versions of Python
Some formulae declare multiple Python dependencies, and they can appear in any order in the `deps` array. Let's make sure to prefer the newest one when adding their `libexec/"bin"` directory to `PATH`.
This commit is contained in:
parent
999623b45d
commit
8064a39c18
@ -125,7 +125,10 @@ module Superenv
|
||||
|
||||
sig { returns(T::Array[Pathname]) }
|
||||
def homebrew_extra_paths
|
||||
# Reverse sort by version so that we prefer the newest when there are multiple.
|
||||
deps.select { |d| d.name.match? Version.formula_optionally_versioned_regex(:python) }
|
||||
.sort_by(&:version)
|
||||
.reverse
|
||||
.map { |d| d.opt_libexec/"bin" }
|
||||
end
|
||||
alias generic_homebrew_extra_paths homebrew_extra_paths
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user