diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index ae8422e258..49d0f75396 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -10,7 +10,7 @@ def bottle_filename f, bottle_version=nil end def install_bottle? f - return true if ARGV.include? '--install-bottle' + return true if ARGV.include? '--install-bottle' and MacOS.bottles_supported?(true) return true if f.downloader and defined? f.downloader.local_bottle_path \ and f.downloader.local_bottle_path not ARGV.build_from_source? \ diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index a871559da5..eb995bf28e 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -130,7 +130,7 @@ module HomebrewArgvExtension end def build_bottle? - include? '--build-bottle' and MacOS.bottles_supported? + include? '--build-bottle' and MacOS.bottles_supported?(true) end def build_from_source? diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index c662b953cd..8cc8de2d28 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -228,11 +228,24 @@ module MacOS extend self `/usr/sbin/pkgutil --pkg-info "#{id}" 2>/dev/null`.strip end - def bottles_supported? + def bottles_supported? raise_if_failed=false # We support bottles on all versions of OS X except 32-bit Snow Leopard. - (Hardware.is_64_bit? or not MacOS.version >= :snow_leopard) \ - and HOMEBREW_PREFIX.to_s == '/usr/local' \ - and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \ + unless Hardware.is_64_bit? or MacOS.version >= :snow_leopard + return false unless raise_if_failed + raise "Bottles are not supported on 32-bit Snow Leopard." + end + + unless HOMEBREW_PREFIX.to_s == '/usr/local' + return false unless raise_if_failed + raise "Bottles are only supported with a /usr/local prefix." + end + + unless HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' + return false unless raise_if_failed + raise "Bottles are only supported with a /usr/local/Cellar cellar." + end + + true end end