aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-06-29 00:38:00 -0500
committerJack Nagel2012-06-29 00:55:01 -0500
commit7f3204aa7c9ea35be3d1638fd9b13b2163ebafd0 (patch)
tree637741c9a906fb79c0ab27f4d8dab361983e2992 /Library
parent2334a5feff226912a795540c0c6ed042e86f0119 (diff)
downloadhomebrew-7f3204aa7c9ea35be3d1638fd9b13b2163ebafd0.tar.bz2
Refactor PATH setup
- Make ORIGINAL_PATHS an array of Pathnames instead of strings - Append the dev tools path once in global.rb instead of build.rb Closes #13075. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/build.rb7
-rw-r--r--Library/Homebrew/global.rb7
2 files changed, 6 insertions, 8 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index b237fc447..271e7f141 100755
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -4,8 +4,6 @@
# Rationale: Formula can use __END__, Formula can change ENV
# Thrown exceptions are propogated back to the parent process over a pipe
-ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| File.expand_path p }
-
require 'global'
at_exit do
@@ -22,10 +20,7 @@ at_exit do
ENV.extend(HomebrewEnvExtension)
ENV.setup_build_environment
# we must do this or tools like pkg-config won't get found by configure scripts etc.
- ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? "#{HOMEBREW_PREFIX}/bin"
- # this is a safety measure for Xcode 4.3 which started not installing
- # dev tools into /usr/bin as a default
- ENV.prepend 'PATH', MacOS.dev_tools_path, ':' unless ORIGINAL_PATHS.include? MacOS.dev_tools_path
+ ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
# Force any future invocations of sudo to require the user's password to be
# re-entered. This is in-case any build script call sudo. Certainly this is
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 91821734a..f403d67d2 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -92,7 +92,10 @@ unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT']
require 'compatibility'
end
-# For Xcode-only installs, we add the path of the included unix tools (like git)
-if MacOS.dev_tools_path.to_s != '/usr/bin'
+ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(File.expand_path(p)) }
+
+# Xcode-only installs place tools in non-standard locations, and we also want
+# to ensure the dev tools are in the PATH in build.rb
+unless ORIGINAL_PATHS.include? MacOS.dev_tools_path
ENV['PATH'] = ENV['PATH'].to_s + ':' + MacOS.dev_tools_path
end