aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2012-08-25 11:49:26 -0700
committerMike McQuaid2012-08-25 11:52:37 -0700
commitd5b954ebd4c3c8c43584e04976da071c6ac76cf4 (patch)
treef9877009dbeb5d547ee9bf394a60278663331e21
parent3af3bc7dd5417c2ce17807e44be968ec63824936 (diff)
downloadbrew-d5b954ebd4c3c8c43584e04976da071c6ac76cf4.tar.bz2
Fix ARGV and bottles circular dependency.
-rw-r--r--Library/Homebrew/bottles.rb9
-rw-r--r--Library/Homebrew/extend/ARGV.rb15
2 files changed, 14 insertions, 10 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index 81c94262e..6b8a4875a 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 e8a227258..4d8663394 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