diff options
| author | Max Howell | 2009-10-26 18:14:39 +0000 |
|---|---|---|
| committer | Max Howell | 2009-11-04 16:27:37 +0000 |
| commit | e046e1e64094547f7d84f60a03360c3c84ba7d2c (patch) | |
| tree | e8d7fe8f3957625b4c94bcc55c3caeab062cdd22 /Library/Homebrew | |
| parent | adf8d30a92b201041317f0ecb0e47fe758e8ce06 (diff) | |
| download | brew-e046e1e64094547f7d84f60a03360c3c84ba7d2c.tar.bz2 | |
More useful Macports/Fink detection function
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/brew.h.rb | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index 144e4683d..d8c64b6fa 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -262,45 +262,37 @@ def diy end end - -def warn_about_macports_or_fink +def macports_or_fink_installed? # See these issues for some history: # http://github.com/mxcl/homebrew/issues/#issue/13 # http://github.com/mxcl/homebrew/issues/#issue/41 # 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 + return ponk unless path.empty? end - + # 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 + return ponk if File.exist? ponk end - - # finally sometimes people make their MacPorts or Fink read-only so they + + # 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 + path = Pathname.new(path) + return path if path.exist? and not path.readable? end + + false end - def versions_of(keg_name) `ls #{HOMEBREW_CELLAR}/#{keg_name}`.collect { |version| version.strip }.reverse end |
