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 Homebrew/homebrew#13075. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
f2e076e5cc
commit
60b518278b
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user