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.
This commit is contained in:
Tim D. Smith 2016-10-04 09:47:14 -07:00 committed by Tim D. Smith
parent a7a2aef803
commit 47d57ca995

View File

@ -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.