From a379fc7f7996dafaf40c926ae5b16ef3b7665589 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 20 Apr 2014 22:39:47 -0500 Subject: [PATCH] Remove nil split monkeypatch --- Library/ENV/4.3/cc | 13 +++++++++---- Library/ENV/libsuperenv.rb | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 13ad9d7a4a..cfa68f6cff 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -217,15 +217,17 @@ class Cmd syspath.map{|d| "#{d}/lib" }.reject{|d| d == "#{brewfix}/lib" } end def cpath - cpath = ENV['CMAKE_PREFIX_PATH'].split(':').map{|d| "#{d}/include" } + ENV['CMAKE_INCLUDE_PATH'].split(':') + cpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "include") } + cpath += path_split("CMAKE_INCLUDE_PATH") opt = cpath.grep(%r{^#{Regexp.escape(brewfix)}/opt}) sys = cpath - opt [sys, opt] end def libpath - ENV['CMAKE_PREFIX_PATH'].split(':').map{|d| "#{d}/lib" } + - ENV['CMAKE_LIBRARY_PATH'].split(':') - - syslibpath + libpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "lib") } + libpath += path_split("CMAKE_LIBRARY_PATH") + libpath -= syslibpath + libpath end def ldflags args = path_flags("-L", libpath) @@ -278,6 +280,9 @@ class Cmd paths = paths.uniq.select { |path| File.directory?(path) } paths.map! { |path| prefix + path } end + def path_split(key) + ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR) + end end if __FILE__ == $PROGRAM_NAME diff --git a/Library/ENV/libsuperenv.rb b/Library/ENV/libsuperenv.rb index 1b4ffa19db..658d5d9eaa 100644 --- a/Library/ENV/libsuperenv.rb +++ b/Library/ENV/libsuperenv.rb @@ -11,5 +11,4 @@ end class NilClass def chuzzle; end - def split(x); [] end end