From 9cab3011856d0d4308054887f7459dc91e444ed3 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Wed, 27 Jan 2016 00:54:46 +0100 Subject: [PATCH] diagnostic: improve check for 'gnubin' in PATH Both `coreutils` and `findutils` suggest to add `#{opt_libexec}/gnubin` to PATH in their caveats to get the non-prefixed binaries from those formulae. Check this in addition to the version-specific directory that is less likely to be in PATH. Closes Homebrew/homebrew#48207. Signed-off-by: Martin Afanasjew --- Library/Homebrew/diagnostic.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 1c74d9a0c3..c2f11b5cfc 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -1198,20 +1198,28 @@ module Homebrew end def check_for_non_prefixed_coreutils - gnubin = "#{Formulary.factory("coreutils").prefix}/libexec/gnubin" - if paths.include? gnubin then <<-EOS.undent + coreutils = Formula["coreutils"] + return unless coreutils.any_version_installed? + + gnubin = %W[#{coreutils.opt_libexec}/gnubin #{coreutils.libexec}/gnubin] + return if (paths & gnubin).empty? + + <<-EOS.undent Putting non-prefixed coreutils in your path can cause gmp builds to fail. - EOS - end + EOS end def check_for_non_prefixed_findutils - gnubin = "#{Formulary.factory("findutils").prefix}/libexec/gnubin" + findutils = Formula["findutils"] + return unless findutils.any_version_installed? + + gnubin = %W[#{findutils.opt_libexec}/gnubin #{findutils.libexec}/gnubin] default_names = Tab.for_name("findutils").with? "default-names" - if paths.include?(gnubin) || default_names then <<-EOS.undent + return if !default_names && (paths & gnubin).empty? + + <<-EOS.undent Putting non-prefixed findutils in your path can cause python builds to fail. - EOS - end + EOS end def check_for_pydistutils_cfg_in_home