python_requirement: prefer Homebrew's Python

This avoids linkage to both system Python and Homebrew's python.
This commit is contained in:
ilovezfs 2017-07-20 02:54:04 -07:00
parent e715649354
commit 4fb7626ce5

View File

@ -18,12 +18,12 @@ class PythonRequirement < Requirement
if !system_python? && short_version == Version.create("2.7")
ENV.prepend_path "PATH", which_python.dirname
# Homebrew Python should take precedence over older Pythons in the PATH
elsif short_version != Version.create("2.7")
ENV.prepend_path "PATH", Formula["python"].opt_bin
ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin"
end
# Homebrew Python should take precedence over other Pythons in the PATH
ENV.prepend_path "PATH", Formula["python"].opt_bin
ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin"
ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
end