From cb58bd779b2ce04258793939d473966d149a0c63 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 20 Apr 2014 22:39:47 -0500 Subject: [PATCH] Remove last monkeypatch --- Library/ENV/4.3/cc | 13 +++++++++---- Library/ENV/libsuperenv.rb | 14 -------------- 2 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 Library/ENV/libsuperenv.rb diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index cfa68f6cff..b6ecfea886 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -1,6 +1,6 @@ #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 -require File.expand_path("../libsuperenv", File.dirname(__FILE__)) +$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8" require 'pathname' require 'set' require 'stringio' @@ -147,11 +147,11 @@ class Cmd args << "-Wl,#{arg}" when /^-I(.+)?/ # Support both "-Ifoo" (one argument) and "-I foo" (two arguments) - val = $1.chuzzle || whittler.next + val = chuzzle($1) || whittler.next path = canonical_path(val) args << "-I#{val}" if keep?(path) and iset.add?(path) when /^-L(.+)?/ - val = $1.chuzzle || whittler.next + val = chuzzle($1) || whittler.next path = canonical_path(val) args << "-L#{val}" if keep?(path) and lset.add?(path) else @@ -283,13 +283,18 @@ class Cmd def path_split(key) ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR) end + def chuzzle(val) + return val if val.nil? + val = val.chomp + return val unless val.empty? + end end if __FILE__ == $PROGRAM_NAME ##################################################################### sanity abort "The build-tool has reset ENV. --env=std required." unless ENV['HOMEBREW_BREW_FILE'] - case ENV['HOMEBREW_CC'].chuzzle when 'cc', nil + if (cc = ENV["HOMEBREW_CC"]).nil? || cc.empty? || cc == "cc" # those values are not allowed ENV['HOMEBREW_CC'] = 'clang' end diff --git a/Library/ENV/libsuperenv.rb b/Library/ENV/libsuperenv.rb deleted file mode 100644 index 658d5d9eaa..0000000000 --- a/Library/ENV/libsuperenv.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Yes, a good deal of this could be imported from Homebrew-proper -# But Homebrew-proper is dog-slow currently, and I didn't want every cc -# instantiation to be slower by a tangible amount. - -# https://github.com/Homebrew/homebrew-versions/issues/47 -$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8" - -class String - def chuzzle; s = chomp; s unless s.empty? end -end - -class NilClass - def chuzzle; end -end