diff options
| author | Jack Nagel | 2012-12-17 17:05:53 -0600 |
|---|---|---|
| committer | Jack Nagel | 2012-12-17 17:18:22 -0600 |
| commit | 3dcce70a6af0a187f6c30e66cef45bee3cae6a6f (patch) | |
| tree | 5ff5af6efba3b34be927cb62b54be2cfedd90eb3 /Library/Homebrew/macos.rb | |
| parent | 68d1dfe5d77781e74cab72f0950484ae58d5e425 (diff) | |
| download | brew-3dcce70a6af0a187f6c30e66cef45bee3cae6a6f.tar.bz2 | |
Better reporting for MacPorts/Fink installations
closes Homebrew/homebrew#15853.
Diffstat (limited to 'Library/Homebrew/macos.rb')
| -rw-r--r-- | Library/Homebrew/macos.rb | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 321162699..fe9829a9b 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -137,36 +137,37 @@ module MacOS extend self end end - 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 - return false unless MACOS - - %w[port fink].each do |ponk| + # 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 + def macports_or_fink + paths = [] + + # First look in the path because MacPorts is relocatable and Fink + # may become relocatable in the future. + %w{port fink}.each do |ponk| path = which(ponk) - return ponk unless path.nil? + paths << path unless path.nil? 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| - return ponk if File.exist? ponk + # Look in the standard locations, because even if port or fink are + # not in the path they can still break builds if the build scripts + # have these paths baked in. + %w{/sw/bin/fink /opt/local/bin/port}.each do |ponk| + path = Pathname.new(ponk) + paths << path if path.exist? 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| - path = Pathname.new(path) - return path if path.exist? and not path.readable? + # Finally, some users make their MacPorts or Fink directorie + # read-only in order to try out Homebrew, but this doens't work as + # some build scripts error out when trying to read from these now + # unreadable paths. + %w{/sw /opt/local}.map { |p| Pathname.new(p) }.each do |path| + paths << path if path.exist? && !path.readable? end - false + paths.uniq end def prefer_64_bit? |
