diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 81c94262ef..6b8a4875a8 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -8,13 +8,12 @@ def bottle_filename f, bottle_version=nil "#{name}-#{version}#{bottle_native_suffix(bottle_version)}" end -def bottles_supported? - HOMEBREW_PREFIX.to_s == '/usr/local' and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' and Hardware.is_64_bit? || !MacOS.snow_leopard? -end - def install_bottle? f return true if ARGV.include? '--install-bottle' - not ARGV.build_from_source? and bottle_current?(f) + not ARGV.build_from_source? \ + and ARGV.bottles_supported? \ + and ARGV.options_only.empty? \ + and bottle_current?(f) end def built_as_bottle? f diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index e8a227258c..4d8663394f 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -124,15 +124,20 @@ module HomebrewArgvExtension include? '--32-bit' end + def bottles_supported? + # Snow Leopard was the only version of OS X that supported + # both 64-bit and 32-bit processors and kernels. + (Hardware.is_64_bit? or not MacOS.snow_leopard?) \ + and HOMEBREW_PREFIX.to_s == '/usr/local' \ + and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \ + end + def build_bottle? - require 'bottles' - bottles_supported? and include? '--build-bottle' + include? '--build-bottle' and bottles_supported? end def build_from_source? - require 'bottles' - flag? '--build-from-source' or ENV['HOMEBREW_BUILD_FROM_SOURCE'] \ - or not bottles_supported? or not options_only.empty? + include? '--build-from-source' or ENV['HOMEBREW_BUILD_FROM_SOURCE'] end def flag? flag