aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2012-08-25 11:49:26 -0700
committerMike McQuaid2012-08-25 11:52:37 -0700
commit0d1c1491c4708371c6fbbbf6977593554ce00380 (patch)
tree660ecb336e21122c1d79f6ed16d57abd928699a4 /Library
parent8837423a5a9643cf1b2e824c9a31cc72a78c516b (diff)
downloadhomebrew-0d1c1491c4708371c6fbbbf6977593554ce00380.tar.bz2
Fix ARGV and bottles circular dependency.
Diffstat (limited to 'Library')
-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