aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-09-23 16:41:47 +0100
committerMax Howell2009-09-24 18:26:24 +0100
commit034fc40ae122f0d99ea0793264ed74c986866327 (patch)
tree25de936d275bba89ab781c509d82fd27df8e0747 /Library
parenta03d13088f7e5f6dfe1d4d6518d2399172d40a2f (diff)
downloadbrew-034fc40ae122f0d99ea0793264ed74c986866327.tar.bz2
Remove Fink and Macports from the PATH earlier
References issue Homebrew/homebrew#48
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.h.rb17
-rw-r--r--Library/Homebrew/brewkit.rb8
2 files changed, 17 insertions, 8 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index 0ec3e2c00..7a5e55fea 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -229,6 +229,23 @@ def diy
end
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?
+ 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
+ end
+ ENV['PATH'] = paths*':'
+end
################################################################ class Cleaner
class Cleaner
def initialize f
diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb
index be22ca675..132bda851 100644
--- a/Library/Homebrew/brewkit.rb
+++ b/Library/Homebrew/brewkit.rb
@@ -175,14 +175,6 @@ end
ENV.extend HomebrewEnvExtension
-# remove MacPorts and Fink from the PATH, this prevents issues like:
-# http://github.com/mxcl/homebrew/issues/#issue/13
-paths=ENV['PATH'].split(':').reject do |p|
- p.squeeze! '/'
- p =~ %r[^/opt/local] or p =~ %r[^/sw]
-end
-ENV['PATH']=paths*':'
-
# Clear CDPATH to avoid make issues that depend on changing directories
ENV.delete('CDPATH')