language/python: expect @ in python@2 Cellar paths

The realpath of the python@2 Cellar contains "python@2" not "python2" so
check for "python@2" when doing Cellar->opt robustifications.
This commit is contained in:
ilovezfs 2018-03-08 08:10:48 -08:00
parent 74443999f4
commit 34bd99af8d

View File

@ -184,7 +184,7 @@ module Language
@venv_root.find do |f|
next unless f.symlink?
next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR
python = rp.include?("python2") ? "python2" : "python"
python = rp.include?("python@2") ? "python@2" : "python"
new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
f.unlink
f.make_symlink new_target
@ -192,7 +192,7 @@ module Language
Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file|
prefix_path = prefix_file.read
python = prefix_path.include?("python2") ? "python2" : "python"
python = prefix_path.include?("python@2") ? "python@2" : "python"
prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
prefix_file.atomic_write prefix_path
end