From 124cdb6995835678d8f12cdc6e43960fb6cf4c9f Mon Sep 17 00:00:00 2001 From: nibbles 2bits Date: Mon, 2 Apr 2012 20:24:54 -0700 Subject: mapnik: fix compile error with system Python Mapnik by default tries to install to the site-packages in /System when brewed against system Python. This causes a build error because that directory is not writeable. Mapnik correctly determines the versioned site-packages name without modification, but for Homebrew it needs the proper prefix. * Add the standard `which_python` function to the formula. * Add a scons argument for `PYTHON_PREFIX` * Add the standard caveat for `PYTHONPATH`. Discussed upstream: https://github.com/mapnik/mapnik/issues/1155 and tested on Lion against the system Python. Fixes #11389 Closes #11407. Signed-off-by: Jack Nagel --- Library/Formula/mapnik.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Library/Formula') diff --git a/Library/Formula/mapnik.rb b/Library/Formula/mapnik.rb index 8625db7cf..1c3ee0c35 100644 --- a/Library/Formula/mapnik.rb +++ b/Library/Formula/mapnik.rb @@ -26,9 +26,20 @@ class Mapnik < Formula "JOBS=#{ENV.make_jobs}", "PREFIX=#{prefix}", "ICU_INCLUDES=#{icu.include}", - "ICU_LIBS=#{icu.lib}" + "ICU_LIBS=#{icu.lib}", + "PYTHON_PREFIX=#{prefix}" # Install to Homebrew's site-packages system "python", "scons/scons.py", "install" end + + def caveats; <<-EOS.undent + For non-homebrew Python, you need to amend your PYTHONPATH like so: + export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH + EOS + end + + def which_python + "python" + `python -c 'import sys;print(sys.version[:3])'`.strip + end end -- cgit v1.2.3