From 47d57ca99526d47897a0bbe98a1f6a5ba466167f Mon Sep 17 00:00:00 2001 From: Tim D. Smith Date: Tue, 4 Oct 2016 09:47:14 -0700 Subject: Immortalize virtualenvs better virtualenvs remember the prefix of the python that created them and do magic to load packages from them; help them remember a more durable path. --- Library/Homebrew/language/python.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index b28b1ca60..23c5246ba 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -215,6 +215,13 @@ module Language f.unlink f.make_symlink new_target end + + Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file| + prefix_path = prefix_file.read + python = prefix_path.include?("python3") ? "python3" : "python" + prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix + prefix_file.atomic_write prefix_path + end end # Installs packages represented by `targets` into the virtualenv. -- cgit v1.2.3