Revert "python_requirement: fix ENV for python3"
This reverts commit 85271644b0083cbc0fd6fea71120d1ad859fbc2a. Alex noticed that setting PYTHONPATH causes weirdness if we depend_on something which may be optionally built --with-python3; PYTHONPATH unexpectedly contains python3 modules in the depending formula if the formula upon which it depends was built --with-python3 even though the depending formula may only use python2. Closes Homebrew/homebrew#43724. Closes Homebrew/homebrew#43744.
This commit is contained in:
parent
0357673f21
commit
5997812ed2
@ -24,8 +24,10 @@ class PythonRequirement < Requirement
|
|||||||
ENV.prepend_path "PATH", Formula["python"].opt_bin
|
ENV.prepend_path "PATH", Formula["python"].opt_bin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if python_binary == "python"
|
||||||
ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
|
ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def python_short_version
|
def python_short_version
|
||||||
@short_version ||= Language::Python.major_minor_version which_python
|
@short_version ||= Language::Python.major_minor_version which_python
|
||||||
@ -60,10 +62,6 @@ class Python3Requirement < PythonRequirement
|
|||||||
|
|
||||||
satisfy(:build_env => false) { which_python }
|
satisfy(:build_env => false) { which_python }
|
||||||
|
|
||||||
env do
|
|
||||||
ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{python_short_version}/site-packages"
|
|
||||||
end
|
|
||||||
|
|
||||||
def python_binary
|
def python_binary
|
||||||
"python3"
|
"python3"
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user