aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cmd/install.rb2
-rw-r--r--Library/Homebrew/cmd/reinstall.rb2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb2
-rw-r--r--Library/Homebrew/compat/macos.rb4
-rw-r--r--Library/Homebrew/extend/ENV/super.rb3
-rw-r--r--Library/Homebrew/extend/os/mac/development_tools.rb9
-rw-r--r--Library/Homebrew/formula_installer.rb6
-rw-r--r--Library/Homebrew/os/mac.rb7
-rw-r--r--Library/Homebrew/test/test_formula_installer.rb2
-rw-r--r--Library/Homebrew/test/test_formula_installer_bottle.rb4
10 files changed, 24 insertions, 17 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 56cfbc24f..df9850307 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -96,7 +96,7 @@ module Homebrew
# if the user's flags will prevent bottle only-installations when no
# developer tools are available, we need to stop them early on
- FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
+ FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
ARGV.formulae.each do |f|
# head-only without --HEAD is an error
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 4a23c00ec..dc3a02cef 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -5,7 +5,7 @@ require "formula_installer"
module Homebrew
def reinstall
- FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
+ FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
ARGV.resolved_formulae.each { |f| reinstall_formula(f) }
end
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index c296e7757..e914da3a3 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -13,7 +13,7 @@ require "cleanup"
module Homebrew
def upgrade
- FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
+ FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
Homebrew.perform_preinstall_checks
diff --git a/Library/Homebrew/compat/macos.rb b/Library/Homebrew/compat/macos.rb
index e534e2f2e..4595eeac5 100644
--- a/Library/Homebrew/compat/macos.rb
+++ b/Library/Homebrew/compat/macos.rb
@@ -90,5 +90,9 @@ module OS
def clang_build_version
DevelopmentTools.clang_build_version
end
+
+ def has_apple_developer_tools?
+ DevelopmentTools.installed?
+ end
end
end
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 1ef5c465d..25ee5c0aa 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -1,4 +1,5 @@
require "extend/ENV/shared"
+require "development_tools"
# ### Why `superenv`?
#
@@ -26,7 +27,7 @@ module Superenv
# @private
def self.bin
- return unless MacOS.has_apple_developer_tools?
+ return unless DevelopmentTools.installed?
bin = HOMEBREW_ENV_PATH.subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
bin.realpath unless bin.nil?
diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb
index b80be4c81..1afab513b 100644
--- a/Library/Homebrew/extend/os/mac/development_tools.rb
+++ b/Library/Homebrew/extend/os/mac/development_tools.rb
@@ -1,3 +1,5 @@
+require "os/mac/xcode"
+
# @private
class DevelopmentTools
class << self
@@ -13,6 +15,13 @@ class DevelopmentTools
end
end
+ # Checks if the user has any developer tools installed, either via Xcode
+ # or the CLT. Convenient for guarding against formula builds when building
+ # is impossible.
+ def installed?
+ MacOS::Xcode.installed? || MacOS::CLT.installed?
+ end
+
def default_compiler
case default_cc
# if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index ab0e36029..da626da4c 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -178,13 +178,13 @@ class FormulaInstaller
check_conflicts
- if !pour_bottle? && !formula.bottle_unneeded? && !MacOS.has_apple_developer_tools?
+ if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed?
raise BuildToolsError.new([formula])
end
unless skip_deps_check?
deps = compute_dependencies
- check_dependencies_bottled(deps) if pour_bottle? && !MacOS.has_apple_developer_tools?
+ check_dependencies_bottled(deps) if pour_bottle? && !DevelopmentTools.installed?
install_dependencies(deps)
end
@@ -223,7 +223,7 @@ class FormulaInstaller
@pour_failed = true
onoe e.message
opoo "Bottle installation failed: building from source."
- raise BuildToolsError.new([formula]) unless MacOS.has_apple_developer_tools?
+ raise BuildToolsError.new([formula]) unless DevelopmentTools.installed?
else
@poured_bottle = true
end
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index 6a7044ddb..70cd3e33f 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -61,13 +61,6 @@ module OS
end
end
- # Checks if the user has any developer tools installed, either via Xcode
- # or the CLT. Convenient for guarding against formula builds when building
- # is impossible.
- def has_apple_developer_tools?
- Xcode.installed? || CLT.installed?
- end
-
def active_developer_dir
@active_developer_dir ||= Utils.popen_read("/usr/bin/xcode-select", "-print-path").strip
end
diff --git a/Library/Homebrew/test/test_formula_installer.rb b/Library/Homebrew/test/test_formula_installer.rb
index 9602ec7c1..55b456fba 100644
--- a/Library/Homebrew/test/test_formula_installer.rb
+++ b/Library/Homebrew/test/test_formula_installer.rb
@@ -62,7 +62,7 @@ class InstallTests < Homebrew::TestCase
end
def test_bottle_unneeded_formula_install
- MacOS.stubs(:has_apple_developer_tools?).returns(false)
+ DevelopmentTools.stubs(:installed?).returns(false)
formula = Testball.new
formula.stubs(:bottle_unneeded?).returns(true)
diff --git a/Library/Homebrew/test/test_formula_installer_bottle.rb b/Library/Homebrew/test/test_formula_installer_bottle.rb
index 12306c229..d83c856b7 100644
--- a/Library/Homebrew/test/test_formula_installer_bottle.rb
+++ b/Library/Homebrew/test/test_formula_installer_bottle.rb
@@ -36,7 +36,7 @@ class InstallBottleTests < Homebrew::TestCase
end
def test_a_basic_bottle_install
- MacOS.stubs(:has_apple_developer_tools?).returns(false)
+ DevelopmentTools.stubs(:installed?).returns(false)
temporary_bottle_install(TestballBottle.new) do |f|
# Copied directly from test_formula_installer.rb as we expect
@@ -59,7 +59,7 @@ class InstallBottleTests < Homebrew::TestCase
end
def test_build_tools_error
- MacOS.stubs(:has_apple_developer_tools?).returns(false)
+ DevelopmentTools.stubs(:installed?).returns(false)
# Testball doesn't have a bottle block, so use it to test this behavior
formula = Testball.new