aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorSamuel John2013-09-03 10:46:06 +0200
committerSamuel John2013-09-03 10:46:06 +0200
commit5515fda59a2941db438aa567d1de0c0a508f7625 (patch)
treebde76cca14c0c309f547f13025728d85a49ce6cf /Library/Homebrew/cmd
parentdbaac79f175ca4c49082e5234e1c1d2914464076 (diff)
downloadbrew-5515fda59a2941db438aa567d1de0c0a508f7625.tar.bz2
PythonInstalled: Allow formulae to set/append PYTHONPATH
Improve robustness of `PYTHONPATH` by first unsetting it (during `satisfy`) so that the `PythonInstalled` can get the `python.version` and so forth and then, after that, setting the `PYTHONPATH` to our `global_site_packages`. In the `python_helper` we append to the `PYTHONPATH` so if that var has been set in a formula, it is respected. Brew audit does no longer complain about setting the `ENV['PYTHONPATH']`.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/audit.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 824d1ed69..0fca0b4af 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -568,13 +568,7 @@ class FormulaAuditor
end
end
- if f.requirements.any?{ |r| r.kind_of?(PythonInstalled) }
- # Don't check this for all formulae, because some are allowed to set the
- # PYTHONPATH. E.g. python.rb itself needs to set it.
- if text =~ /ENV\.append.*PYTHONPATH/ || text =~ /ENV\[['"]PYTHONPATH['"]\]\s*=[^=]/
- problem "Don't set the PYTHONPATH, instead declare `depends_on :python`"
- end
- else
+ unless f.requirements.any?{ |r| r.kind_of?(PythonInstalled) }
# So if there is no PythonInstalled requirement, we can check if the
# formula still uses python and should add a `depends_on :python`
unless f.name.to_s =~ /(pypy[0-9]*)|(python[0-9]*)/