aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/os
diff options
context:
space:
mode:
authorJack Nagel2014-05-01 18:36:46 -0500
committerJack Nagel2014-05-01 18:36:46 -0500
commit564b5df2614c112103766202bcea644ab6851d3a (patch)
treee8147bf77e638576da296bbca82628f1df1365fa /Library/Homebrew/os
parent89ed0c544b75dd828a0cfbc7d8a9902330c16f4b (diff)
downloadbrew-564b5df2614c112103766202bcea644ab6851d3a.tar.bz2
Trust xcrun now that we error out early for bad xcode-select paths
Since ae177adb2bd55ee5ad6367e7639c4cf0c774b63a, we can safely assume that xcrun works, and a functioning xcrun will search dev_tools_path and xctoolchain_path, so we can stop doing extra work here. On CLT-only 10.7 and 10.8, xcrun will not work, but all the tools will be in /usr/bin, which we check before invoking xcrun. Further, in this case, dev_tools_path will be /usr/bin, and xctoolchain_path will not exist, so the fallbacks here are unnecessary.
Diffstat (limited to 'Library/Homebrew/os')
-rw-r--r--Library/Homebrew/os/mac.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index 83fad256f..37939264d 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -27,25 +27,11 @@ module OS
@locate[key] = 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 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 = begin
- path = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp
- # If xcrun finds a superenv tool then discard the result.
- path unless path.include?("Library/ENV")
- end
-
- paths = %W[#{xcrun_path}
- #{dev_tools_path}/#{tool}
- #{xctoolchain_path}/usr/bin/#{tool}]
- paths.map { |p| Pathname.new(p) }.find { |p| p.executable? }
+ path = `/usr/bin/xcrun -no-cache -find #{tool} 2>/dev/null`.chomp
+ Pathname.new(path) if File.executable?(path)
end
end
end