diff options
| author | Jack Nagel | 2013-10-18 12:56:51 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-10-18 12:56:51 -0500 |
| commit | c511d7d2f43369773940dbb8fb8fbe8ed2153127 (patch) | |
| tree | a68a04144c13d382da771d8c0a70208cb8453087 | |
| parent | 45e7f0ccb09f29ef4180a66d758e21a6c3c6594f (diff) | |
| download | brew-c511d7d2f43369773940dbb8fb8fbe8ed2153127.tar.bz2 | |
Add OS.mac? and OS.linux?
| -rw-r--r-- | Library/Homebrew/extend/ENV/std.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/global.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/hardware.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/macos.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xcode.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testing_env.rb | 1 | ||||
| -rwxr-xr-x | Library/brew.rb | 2 |
10 files changed, 19 insertions, 12 deletions
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 03273fc88..09c36ae68 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -224,7 +224,7 @@ module Stdenv end def macosxsdk version=MacOS.version - return unless MACOS + return unless OS.mac? # Sets all needed lib and include dirs to CFLAGS, CPPFLAGS, LDFLAGS. remove_macosxsdk version = version.to_s diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index f09a2d6eb..a7b233cf3 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -384,7 +384,7 @@ class FormulaInstaller link end - fix_install_names + fix_install_names if OS.mac? record_cxx_stdlib diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 36e5cf992..dc809021d 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -5,6 +5,7 @@ require 'extend/ARGV' require 'extend/string' require 'extend/symbol' require 'extend/enumerable' +require 'os' require 'utils' require 'exceptions' require 'set' @@ -72,11 +73,9 @@ if RUBY_PLATFORM =~ /darwin/ MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp MACOS_VERSION = MACOS_FULL_VERSION[/10\.\d+/].to_f OS_VERSION = "Mac OS X #{MACOS_FULL_VERSION}" - MACOS = true else MACOS_FULL_VERSION = MACOS_VERSION = 0 OS_VERSION = RUBY_PLATFORM - MACOS = false end HOMEBREW_GITHUB_API_TOKEN = ENV["HOMEBREW_GITHUB_API_TOKEN"] diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 44642d44f..0a52d10db 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -1,3 +1,5 @@ +require 'os' + class Hardware module CPU extend self INTEL_32BIT_ARCHS = [:i386].freeze @@ -30,11 +32,10 @@ class Hardware end end - case RUBY_PLATFORM.downcase - when /darwin/ + if OS.mac? require 'os/mac/hardware' CPU.extend MacCPUs - when /linux/ + elsif OS.linux? require 'os/linux/hardware' CPU.extend LinuxCPUs else diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index c9ff7b4bc..694daaba8 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -1,6 +1,5 @@ class Keg def fix_install_names options={} - return unless MACOS mach_o_files.each do |file| install_names_for(file, options) do |id, bad_names| file.ensure_writable do diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index b3e4b6452..1caaa8b43 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -253,7 +253,7 @@ module MacOS extend self end def mdfind id - return [] unless MACOS + return [] unless OS.mac? (@mdfind ||= {}).fetch(id.to_s) do |key| @mdfind[key] = `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{key}'"`.split("\n") end diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb new file mode 100644 index 000000000..e16c81c7d --- /dev/null +++ b/Library/Homebrew/os.rb @@ -0,0 +1,9 @@ +module OS + def self.mac? + /darwin/i === RUBY_PLATFORM + end + + def self.linux? + /linux/i === RUBY_PLATFORM + end +end diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 1279be1d1..0472f73ab 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -84,7 +84,7 @@ module MacOS::Xcode extend self # This is a separate function as you can't cache the value out of a block # if return is used in the middle, which we do many times in here. - return "0" unless MACOS + return "0" unless OS.mac? # this shortcut makes version work for people who don't realise you # need to install the CLI tools diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index 9bc5d871f..a7b25aa20 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -29,7 +29,6 @@ HOMEBREW_VERSION = '0.9-test' RUBY_BIN = Pathname.new(RbConfig::CONFIG['bindir']) RUBY_PATH = RUBY_BIN + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT'] -MACOS = true MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp MACOS_VERSION = ENV.fetch('MACOS_VERSION') { MACOS_FULL_VERSION[/10\.\d+/] }.to_f diff --git a/Library/brew.rb b/Library/brew.rb index 1ec1ad4c0..b72d61494 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -35,7 +35,7 @@ case HOMEBREW_PREFIX.to_s when '/', '/usr' # it may work, but I only see pain this route and don't want to support it abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}" end -if MACOS and MACOS_VERSION < 10.5 +if OS.mac? and MacOS.version < 10.5 abort <<-EOABORT.undent Homebrew requires Leopard or higher. For Tiger support, see: https://github.com/mistydemeo/tigerbrew |
