From 5515fda59a2941db438aa567d1de0c0a508f7625 Mon Sep 17 00:00:00 2001 From: Samuel John Date: Tue, 3 Sep 2013 10:46:06 +0200 Subject: 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']`. --- Library/Homebrew/cmd/audit.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Library/Homebrew/cmd') 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]*)/ -- cgit v1.2.3