python: use .min instead of .sort.first. (#26726)

This commit is contained in:
Mike McQuaid 2018-04-17 11:35:38 +01:00 committed by ilovezfs
parent e27c4c3214
commit f1f8fcbdb2

View file

@ -206,7 +206,7 @@ class Python < Formula
def post_install
ENV.delete "PYTHONPATH"
xy = (prefix/"Frameworks/Python.framework/Versions").children.sort.first.basename.to_s
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
site_packages = HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
site_packages_cellar = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/site-packages"
@ -283,7 +283,7 @@ class Python < Formula
end
def sitecustomize
xy = (prefix/"Frameworks/Python.framework/Versions").children.sort.first.basename.to_s
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
<<~EOS
# This file is created by Homebrew and is executed on each python startup.
@ -324,7 +324,7 @@ class Python < Formula
def caveats
if prefix.exist?
xy = (prefix/"Frameworks/Python.framework/Versions").children.sort.first.basename.to_s
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
else
xy = version.to_s.slice(/(3\.\d)/) || "3.6"
end
@ -362,7 +362,7 @@ class Python < Formula
end
test do
xy = (prefix/"Frameworks/Python.framework/Versions").children.sort.first.basename.to_s
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system "#{bin}/python#{xy}", "-c", "import sqlite3"