More useful Macports/Fink detection function

This commit is contained in:
Max Howell 2009-10-26 18:14:39 +00:00
parent adf8d30a92
commit e046e1e640
2 changed files with 13 additions and 20 deletions

View File

@ -262,8 +262,7 @@ 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
@ -271,10 +270,7 @@ def warn_about_macports_or_fink
%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
@ -282,24 +278,20 @@ def warn_about_macports_or_fink
# 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
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

View File

@ -296,7 +296,8 @@ rescue Exception => e
puts "Please report this bug at: #{HOMEBREW_WWW}"
puts "Please include the following information:"
ohai "Environment"
puts "Mac OS X: "+`sw_vers -productVersion`
puts "Mac OS X #{MACOS_VERSION}"
puts "Macports or Fink? #{macports_or_fink_installed?}"
ohai e.inspect
puts e.backtrace
exit 1