Linking Frameworks correctly if multiple.

For example python and python3 both provide a
`Python.framework` and OS X Frameworks are made to
deal with this by putting them into `Versions` and
linking the default one as `Current`. However, brew
did not respect this and cleaned out stuff making
neither of the two versions work because `Current`
is replaced by an empty directory.

This commit fixes that. However, still one of the
two `Python.frameworks` has to remove it's
`Current` and `Headers` links, because brew cannot
decide alone which one is the "default" and allowed
to set the `Current` link.

A similar situation might apply to Qt 4 vs. 5..
This commit is contained in:
Samuel John 2013-06-17 09:01:37 +02:00
parent a3a0146d7c
commit fbaf8a5968

View File

@ -115,7 +115,6 @@ class Keg < Pathname
link_dir('bin', mode) {:skip_dir}
link_dir('sbin', mode) {:skip_dir}
link_dir('include', mode) {:link}
link_dir('Frameworks', mode) { :link }
link_dir('share', mode) do |path|
case path.to_s
@ -148,6 +147,18 @@ class Keg < Pathname
end
end
link_dir('Frameworks', mode) do |path|
# Frameworks contain symlinks pointing into a subdir, so we have to use
# the :link strategy. However, for Foo.framework and
# Foo.framework/Versions we have to use :mkpath so that multiple formulae
# can link their versions into it and `brew [un]link` works.
if path.to_s =~ /[^\/]*\.framework(\/Versions)?$/
:mkpath
else
:link
end
end
unless mode.dry_run
linked_keg_record.make_relative_symlink(self)
optlink