diff options
| author | Max Howell | 2009-09-27 23:55:40 +0100 |
|---|---|---|
| committer | Max Howell | 2009-09-28 00:20:51 +0100 |
| commit | 1004df181ec8ff14d9802533afd6614cefb9890b (patch) | |
| tree | 0972079cef3bdb25211f8710c04283697f1b1ae1 /Library | |
| parent | fab877de187fe2729ea7331b8b453d735972e22b (diff) | |
| download | brew-1004df181ec8ff14d9802533afd6614cefb9890b.tar.bz2 | |
fix_PATH changed to warn_about_macports_or_fink
We shouldn't mess with the user's PATH anyway. So assume our users are smart and just warn them about potential issues instead.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/brew.h.rb | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index b2e56f8cf..a30a82b80 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -228,21 +228,40 @@ def diy end -def fix_PATH - bad_paths = `/usr/bin/which -a port`.split - bad_paths += `/usr/bin/which -a fink`.split - - # don't remove standard paths! - bad_paths.delete_if do |pn| - %w[/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin].include? pn or pn.empty? +def warn_about_macports_or_fink + # See these issues for some history: + # http://github.com/mxcl/homebrew/issues/#issue/13 + # http://github.com/mxcl/homebrew/issues/#issue/48 + + %w[port fink].each do |ponk| + path = `/usr/bin/which -s #{ponk}` + unless path.empty? + opoo "It appears you have Macports or Fink in your PATH" + puts "If formula fail to build try renaming or uninstalling these tools." + end end - bad_paths += %w[/opt/local/bin /opt/local/sbin /sw/bin /sw/sbin] - - paths = ENV['PATH'].split(':').reject do |p| - p.squeeze! '/' - bad_paths.find { |pn| p =~ /^#{pn}/ } and true + + # we do the above check because macports can be relocated and fink may be + # able to be relocated in the future. This following check is because if + # fink and macports are not in the PATH but are still installed it can + # *still* break the build -- because some build scripts hardcode these paths: + %w[/sw/bin/fink /opt/local/bin/port].each do |ponk| + if File.exist? ponk + opoo "It appears you have MacPorts or Fink installed" + puts "If formula fail to build, consider renaming: %s" % Pathname.new(ponk).dirname.parent + end + end + + # finally sometimes people make their MacPorts or Fink read-only so they + # can quickly test Homebrew out, but still in theory obey the README's + # advise to rename the root directory. This doesn't work, many build scripts + # error out when they try to read from these now unreadable directories. + %w[/sw /opt/local].each do |path| + if File.exist? path and not File.readable? path + opoo "It appears you have MacPorts or Fink installed" + puts "This has been known to cause build fails and other more subtle problems." + end end - ENV['PATH'] = paths*':' end |
