Remove nil split monkeypatch

This commit is contained in:
Jack Nagel 2014-04-20 22:39:47 -05:00
parent bef9ec29ef
commit a379fc7f79
2 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -11,5 +11,4 @@ end
class NilClass
def chuzzle; end
def split(x); [] end
end