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 | 584bf9e0e2f6da7428259d9241ef28dd815c841c (patch) | |
| tree | fc8222bb10579942a4f0574e38c1d914dbc6ea4f /Library/Homebrew/macos.rb | |
| parent | c88d73c11547c54803e64d2748d23106702a2073 (diff) | |
| download | homebrew-584bf9e0e2f6da7428259d9241ef28dd815c841c.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/Homebrew/macos.rb')
| -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?  | 
