From d1041319f401d1a3a559d551d7b6a89bc3f4ee0b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 20 Apr 2014 19:57:01 -0500 Subject: [PATCH] Remove "cleanpath" monkeypatch --- Library/ENV/4.3/cc | 14 +++++++++++--- Library/ENV/libsuperenv.rb | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 727fa565ad..d05e81074f 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -1,6 +1,7 @@ #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 require File.expand_path("../libsuperenv", File.dirname(__FILE__)) +require 'pathname' require 'set' require 'stringio' @@ -147,10 +148,12 @@ class Cmd when /^-I(.+)?/ # Support both "-Ifoo" (one argument) and "-I foo" (two arguments) path = $1.chuzzle || whittler.next - args << "-I#{path}" if keep?(path) and iset.add?(path.cleanpath) + path = canonical_path(path) + args << "-I#{path}" if keep?(path) and iset.add?(path) when /^-L(.+)?/ path = $1.chuzzle || whittler.next - args << "-L#{path}" if keep?(path) and lset.add?(path.cleanpath) + path = canonical_path(path) + args << "-L#{path}" if keep?(path) and lset.add?(path) else args << arg end @@ -159,7 +162,7 @@ class Cmd end def keep? path - case path.cleanpath + case path when %r{^#{Regexp.escape(brewfix)}}, %r{^#{Regexp.escape(brewtmp)}} # maybe homebrew is installed to /sw or /opt/brew true @@ -270,6 +273,11 @@ class Cmd def cccfg? flags flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG'] end + def canonical_path(path) + path = Pathname.new(path) + path = path.realpath if path.exist? + path.to_s + end end if __FILE__ == $PROGRAM_NAME diff --git a/Library/ENV/libsuperenv.rb b/Library/ENV/libsuperenv.rb index 5e7035eb2e..c6b8c1c4b9 100644 --- a/Library/ENV/libsuperenv.rb +++ b/Library/ENV/libsuperenv.rb @@ -6,7 +6,6 @@ $:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8" class String - def cleanpath; require 'pathname'; Pathname.new(self).realpath.to_s rescue self end def chuzzle; s = chomp; s unless s.empty? end end