Only interpolate constant regexps once

This commit is contained in:
Jack Nagel 2014-04-21 10:35:05 -05:00
parent eed3368039
commit 9d15aefd2e

View File

@ -171,7 +171,7 @@ class Cmd
def keep? path
case path
when %r{^#{Regexp.escape(brewfix)}}, %r{^#{Regexp.escape(brewtmp)}}
when %r{^#{Regexp.escape(brewfix)}}o, %r{^#{Regexp.escape(brewtmp)}}o
# maybe homebrew is installed to /sw or /opt/brew
true
when %r{^/opt}, %r{^/sw}, %r{/usr/X11}
@ -233,7 +233,7 @@ class Cmd
def cpath
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})
opt = cpath.grep(%r{^#{Regexp.escape(brewfix)}/opt}o)
sys = cpath - opt
[sys, opt]
end