Yeah, I was saying the ORIGINAL_PATHS fix should always work when Homebrew's python is installed, but could still break when there's no brewed python. (IMO It should still be implemented for consistency.) Checking each python* should work in all cases.
> hard code the expectation of the binary name
Not sure how that works.
> disallow all mixed dependency trees
I would vote for that, but never put me in contact with all the people that would be frustrated by that change 😝
How does ENV.delete("PYTHONPATH") fix the problem where python2 is selected when python3 is expected?
I should add that none of the proposals above would fix https://github.com/Homebrew/brew/issues/2958#issuecomment-318917264 for the same reason.
My original proposal still stands, I believe.
> However, it seems that since we're doing
>
> ```
> # 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"
> ```
>
> we should really be putting those paths in front of ORIGINAL_PATHS when we do the which. This might be the source of inconsistency here.
I'll put together a patch tomorrow.
By the way, it won't fix https://github.com/Homebrew/brew/issues/2958#issuecomment-318917264, since that's rooted deeper in the dependency resolution chain.