python: handle env filtering on pth check

Since ENV filtering became the default this has been chucking
erroneous warnings from both `brew doctor` and things like `brew install pygobject`
about needing to run:
```
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/xyz/Library/Python/2.7/lib/python/site-packages/homebrew.pth
```
even though I had Homebrew's `python` installed.
This commit is contained in:
Dominyk Tiller 2017-12-13 06:06:07 +00:00
parent 7b558e0522
commit d6ebdf1e62
No known key found for this signature in database
GPG Key ID: FE19AEFCF658C6F6

View File

@ -35,7 +35,7 @@ module Language
probe_file = homebrew_site_packages(version)/"homebrew-pth-probe.pth"
begin
probe_file.atomic_write("import site; site.homebrew_was_here = True")
quiet_system python, "-c", "import site; assert(site.homebrew_was_here)"
with_homebrew_path { quiet_system python, "-c", "import site; assert(site.homebrew_was_here)" }
ensure
probe_file.unlink if probe_file.exist?
end