Fix ARGV and bottles circular dependency.

This commit is contained in:
Mike McQuaid 2012-08-25 11:49:26 -07:00
parent 3af3bc7dd5
commit d5b954ebd4
2 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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