Allow virtualenvs to find Python bindings provided by deps (#608)
Allow virtualenvs to find Python bindings provided by deps Closes #603.
This commit is contained in:
parent
7a00f03c92
commit
a5a930c48b
@ -122,6 +122,20 @@ module Language
|
||||
ENV.refurbish_args
|
||||
venv = Virtualenv.new formula, venv_root, python
|
||||
venv.create
|
||||
|
||||
# Find any Python bindings provided by recursive dependencies
|
||||
formula_deps = formula.recursive_dependencies
|
||||
xy = Language::Python.major_minor_version python
|
||||
pth_contents = formula_deps.map do |d|
|
||||
next if d.build?
|
||||
dep_site_packages = Formula[d.name].opt_lib/"python#{xy}/site-packages"
|
||||
next unless dep_site_packages.exist?
|
||||
"import site; site.addsitedir('#{dep_site_packages}')\n"
|
||||
end
|
||||
if pth_contents.any?
|
||||
(venv_root/"lib/python#{xy}/site-packages/homebrew_deps.pth").write pth_contents.join
|
||||
end
|
||||
|
||||
venv
|
||||
end
|
||||
|
||||
@ -224,7 +238,7 @@ module Language
|
||||
targets = [targets] unless targets.is_a? Array
|
||||
@formula.system @venv_root/"bin/pip", "install",
|
||||
"-v", "--no-deps", "--no-binary", ":all:",
|
||||
*targets
|
||||
"--ignore-installed", *targets
|
||||
end
|
||||
end # class Virtualenv
|
||||
end # module Virtualenv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user