Skip to content
Snippets Groups Projects
Commit 50db35e5 authored by Jack Nagel's avatar Jack Nagel
Browse files

Use Hardware::CPU module

parent dc454aad
No related branches found
No related tags found
No related merge requests found
......@@ -84,7 +84,7 @@ def bottle_tag
when 10.8, 10.7, 10.5
MacOS.cat
when 10.6
Hardware.is_64_bit? ? :snow_leopard : :snow_leopard_32
Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32
else
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
end
......
......@@ -23,7 +23,7 @@ module Homebrew extend self
end
def check_ppc
case Hardware.cpu_type when :ppc, :dunno
case Hardware::CPU.type when :ppc, :dunno
abort <<-EOS.undent
Sorry, Homebrew does not support your computer's CPU architecture.
For PPC support, see: https://github.com/mistydemeo/tigerbrew
......
......@@ -299,7 +299,7 @@ module HomebrewEnvExtension
unless compiler == :clang
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
replace_in_cflags(/-march=\S*/, '-Xarch_i386 \0') if Hardware.is_32_bit?
replace_in_cflags(/-march=\S*/, '-Xarch_i386 \0') if Hardware::CPU.is_32_bit?
end
end
......@@ -372,7 +372,7 @@ module HomebrewEnvExtension
if self['HOMEBREW_MAKE_JOBS'].to_i > 0
self['HOMEBREW_MAKE_JOBS'].to_i
else
Hardware.processor_count
Hardware::CPU.cores
end
end
......
......@@ -37,12 +37,12 @@ class Hardware
end
def self.cores_as_words
case Hardware.processor_count
case Hardware::CPU.cores
when 1 then 'single'
when 2 then 'dual'
when 4 then 'quad'
else
Hardware.processor_count
Hardware::CPU.cores
end
end
......
......@@ -184,7 +184,7 @@ module MacOS extend self
end
def prefer_64_bit?
Hardware.is_64_bit? and version != :leopard
Hardware::CPU.is_64_bit? and version != :leopard
end
STANDARD_COMPILERS = {
......
......@@ -196,7 +196,7 @@ class << ENV
def determine_make_jobs
if (j = ENV['HOMEBREW_MAKE_JOBS'].to_i) < 1
Hardware.processor_count
Hardware::CPU.cores
else
j
end
......
......@@ -22,13 +22,13 @@ class BottleTagTests < Test::Unit::TestCase
def test_cat_snow_leopard_32
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
Hardware.stubs(:is_64_bit?).returns(false)
Hardware::CPU.stubs(:is_64_bit?).returns(false)
assert_equal :snow_leopard_32, bottle_tag
end
def test_cat_snow_leopard_64
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
Hardware.stubs(:is_64_bit?).returns(true)
Hardware::CPU.stubs(:is_64_bit?).returns(true)
assert_equal :snow_leopard, bottle_tag
end
......
......@@ -9,7 +9,7 @@ class HardwareTests < Test::Unit::TestCase
end
def test_hardware_intel_family
if Hardware.cpu_type == :intel
if Hardware::CPU.type == :intel
assert [:core, :core2, :penryn, :nehalem,
:arrandale, :sandybridge, :ivybridge].include?(Hardware::CPU.family)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment