mapnik-org/mapnik — Issue #207: SCons python install usability improvments
Author: artemp
Created: 2011-10-11 07:42:35+00:00
State: open
Labels: Scons_Build_Scripts

Several tickets have addressed shortcomings of the current handling of the installation of the python bindings:

#10 - Installing in a non-standard location as non-root user (PREFIX not working)
#48 - installing python modules with respect to the PREFIX build option
#137 -Mapnik python bindings on OS 10.5 should not install in /System

The basic issue is that the SCons scripts do not allow enough flexibility in setting the prefix for python installs, and do not attempt to determine the site-packages install location in reliably, cross-platform way.

The attached patch addresses #10 and #48 by adding a user-configurable PathVariable for env['PYTHON_SYS_PREFIX'] and renaming the previously entitled variable to env['PYTHON_SYS_PREFIX'].

It also switches from a concatenation approach for building the python site-packages installation path to using the python standard 'get_python_lib()' from the 'disutils.sysconfig' package.

The 'get_python_inc' from 'disutils.sysconfig' is also used to get the location of header files.

Finally os.popen is replaced with the more modern incarnation -> subprocess Popen, for shelling out to the user specified version of Python, maintaining the ability to build mapnik with a different version of python than mapnik is built and linked against.

Tested on Mac OS 10.5 with python 25 and python 26, as well as ubuntu 8.10 with python 25.