set up Python sys.path from install HOME
Necessary to allow system Python to find Python modules installed by Homebrew. Closes Homebrew/homebrew#45076. Fixes Homebrew/homebrew#43919. Probably fixes Homebrew/homebrew#44813.
This commit is contained in:
parent
e4b4ad532f
commit
55063f0ec7
@ -1273,7 +1273,7 @@ class Formula
|
|||||||
mktemp do
|
mktemp do
|
||||||
@testpath = Pathname.pwd
|
@testpath = Pathname.pwd
|
||||||
ENV["HOME"] = @testpath
|
ENV["HOME"] = @testpath
|
||||||
setup_test_home @testpath
|
setup_home @testpath
|
||||||
test
|
test
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
@ -1309,8 +1309,8 @@ class Formula
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def setup_test_home(home)
|
def setup_home(home)
|
||||||
# keep Homebrew's site-packages in sys.path when testing with system Python
|
# keep Homebrew's site-packages in sys.path when using system Python
|
||||||
user_site_packages = home/"Library/Python/2.7/lib/python/site-packages"
|
user_site_packages = home/"Library/Python/2.7/lib/python/site-packages"
|
||||||
user_site_packages.mkpath
|
user_site_packages.mkpath
|
||||||
(user_site_packages/"homebrew.pth").write <<-EOS.undent
|
(user_site_packages/"homebrew.pth").write <<-EOS.undent
|
||||||
@ -1470,6 +1470,7 @@ class Formula
|
|||||||
mkdir_p env_home
|
mkdir_p env_home
|
||||||
|
|
||||||
old_home, ENV["HOME"] = ENV["HOME"], env_home
|
old_home, ENV["HOME"] = ENV["HOME"], env_home
|
||||||
|
setup_home env_home
|
||||||
|
|
||||||
begin
|
begin
|
||||||
yield
|
yield
|
||||||
|
Loading…
x
Reference in New Issue
Block a user