diff options
| author | Misty De Meo | 2013-07-26 23:21:44 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-07-26 23:22:22 -0700 |
| commit | 6242a6d7fa0b9a928b8bd53560c058f7b876eae4 (patch) | |
| tree | 7f714d287088dacd94800fa355fe3eafb872b953 /Library | |
| parent | 613546a9948828850f9503ce7a07e5813cde729f (diff) | |
| download | brew-6242a6d7fa0b9a928b8bd53560c058f7b876eae4.tar.bz2 | |
MacOS.locate: search HOMEBREW_PREFIX before xcrun
Since xcrun doesn't work on CLT-only systems. Querying HOMEBREW_PREFIX
first before xcrun is much faster for that case.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/macos.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index b86bc8f42..2e5c02f39 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -18,11 +18,16 @@ module MacOS extend self # Give the name of the binary you look for as a string to this method # in order to get the full path back as a Pathname. (@locate ||= {}).fetch(tool.to_s) do - @locate[tool.to_s] = if File.executable? "/usr/bin/#{tool}" - Pathname.new "/usr/bin/#{tool}" + @locate[tool.to_s] = if File.executable?(path = "/usr/bin/#{tool}") + Pathname.new path + # Homebrew GCCs most frequently; much faster to check this before xcrun + # This also needs to be queried if xcrun won't work, e.g. CLT-only + elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}") + Pathname.new path else - # If the tool isn't in /usr/bin, then we first try to use xcrun to find - # it. If it's not there, or xcode-select is misconfigured, we have to + # If the tool isn't in /usr/bin or from Homebrew, + # then we first try to use xcrun to find it. + # If it's not there, or xcode-select is misconfigured, we have to # look in dev_tools_path, and finally in xctoolchain_path, because the # tools were split over two locations beginning with Xcode 4.3+. xcrun_path = unless Xcode.bad_xcode_select_path? |
