aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/language/python.rb
diff options
context:
space:
mode:
authorTim D. Smith2016-10-04 09:47:14 -0700
committerTim D. Smith2016-10-04 22:57:08 -0700
commit47d57ca99526d47897a0bbe98a1f6a5ba466167f (patch)
tree35d4648d848706633d7b896955e03803ee53d1cf /Library/Homebrew/language/python.rb
parenta7a2aef803afbadd49a281b840c0bf9083fcf71e (diff)
downloadbrew-47d57ca99526d47897a0bbe98a1f6a5ba466167f.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/language/python.rb')
-rw-r--r--Library/Homebrew/language/python.rb7
1 files changed, 7 insertions, 0 deletions
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.