Merge pull request #3895 from ilovezfs/python-expect-python@2-in-Cellar-path

language/python: expect @ in python@2 Cellar paths
This commit is contained in:
ilovezfs 2018-03-08 08:54:08 -08:00 committed by GitHub
commit df1fb59d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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