python_helper prepends PYTHONPATH

…instead of appending. This should be safer against any
malformed user-defined values in the PYTHONPATH.
This commit is contained in:
Samuel John 2013-08-08 11:48:16 +02:00
parent 0456e7e5a5
commit fe61524e03

View File

@ -1,4 +1,4 @@
# This is used in the Formula class when the user calls
# This helper method is used in the Formula class when the user calls
# `python`, `python2` or `python3`.
# This method has a dual nature. For one, it takes a &block and sets up
@ -65,9 +65,9 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
# In order to install into the Cellar, the dir must exist and be in the
# PYTHONPATH. This will be executed in the context of the formula
# so that lib points to the HOMEBREW_PREFIX/Cellar/<formula>/<version>/lib
puts "brew: Appending to PYTHONPATH: #{py.site_packages}" if ARGV.verbose?
puts "brew: Prepending to PYTHONPATH: #{py.site_packages}" if ARGV.verbose?
mkdir_p py.site_packages
ENV.append 'PYTHONPATH', py.site_packages, ':'
ENV.prepend 'PYTHONPATH', py.site_packages, ':'
ENV['PYTHON'] = py.binary
ENV.prepend 'CMAKE_INCLUDE_PATH', py.incdir, ':'
ENV.prepend 'PKG_CONFIG_PATH', py.pkg_config_path, ':' if py.pkg_config_path