mxcl/homebrew — pull request #21748 by samueljohn (2013-08-08 09:23:22+00:00)
Title: Keg should link symlinks directly & del empty dirs

If the `src` in the Cellar of a formula is a symlink to another dir
in the same Cellar (for example `Frameworks/QtGui.framework` is a
symlink to `lib/QtGui.framework`), then we should make a symlink
directly instead of possibly creating an empty dir.

This is needed because Ruby's `find` does not follow symlinks (newer
versions can, but we have to support 10.8 for a long time).

Currently this probably only occurs for Qt, where we put symlinks
into the Cellar/Frameworks and the frameworks linking code is a bit
special to create a directory to "merge" together different versions
of the same framework from different formulae. See `python` and
`python3`; both install `Python.framework` and only one can be the
`Current` but the other should still be put into
`Python.framework/Versions`. Therefore `Python.framework` has to
be a dir and no symlink.

Also for `unlink`, we should try a bit harder to remove an empty dir
in the HOMEBREW_PREFIX. Otherwise users that already have those empty
dirs like `HOMEBREW_PREFIX/Frameworks/QtGui.framework` would not be
able to get rid of them by `brew unlink qt`.