Hello, I wrote about three weeks ago [1] that I'm trying to get Boost's Python extension helper library building with multiple Python versions. Several very helpful suggestions were made, for which I am grateful.
I have been plugging away, very slowly, ever since. I'm hoping to upload it later today and I'd appreciate have some second opinions on what I've done. I settled on creating libraries with suffix "-py24" and "-py25" using the available Boost mechanism of "--buildid" since that ensures the SONAME also has "-py24" or "-py25". The shared library files thus coexist peacefully. For the link libraries, I chose to retain both the fully-decorated forms including the "-pyXY" suffix, as well as create symlinks (with no suffix) for those who just want the default python version. These symlinks are maintained by an "rtupdate" script as suggested by a couple of people. Focusing only on the simpler, Debian-specific, library names, the intent is that the following link libraries are availble: libboost_python-py24.a -> libboost_python-gcc42-1_34_1-py24.a libboost_python-py24.so -> libboost_python-gcc42-1_34_1-py24.so libboost_python-py25.a -> libboost_python-gcc42-1_34_1-py25.a libboost_python-py25.so -> libboost_python-gcc42-1_34_1-py25.so libboost_python.a -> libboost_python-py24.a libboost_python.so -> libboost_python-py24.so The rtupdate script (attached) will replace the last two libraries with libboost_python.a -> libboost_python-py25.a libboost_python.so -> libboost_python-py25.so This allows extension builders to select either the default Python version, or a specific version, without knowing the Boost and GCC versions [2]. I'd appreciate any feedback on the above, and especially on what follows. I'd love some folks to look over the attached rtupdate script. My understanding is that this gets run when the Python default version changes. If so, I guess that a bug in the script will cause the Python package install to fail. I'd like to avoid the hate mail generated if that happened; so if you've got a moment, have a look at the script. I'd like to ask about intended behaviour if a bad action is supplied. Or if an unsupported python version is given. I chose to exit with an error message and status 1. Now I'm a little worried that will break some Python installs and generate the hate mail. What's the recommended behaviour here? Note that my libboost-python-dev postinst script calls it to populate the symlinks initially: /usr/share/python/runtime.d/libboost-python-dev.rtupdate \ rtupdate none $(pyversions -d) I also use it in the prerm to remove all the symlinks: /usr/share/python/runtime.d/libboost-python-dev.rtupdate \ remove Thanks, -Steve [1] http://lists.debian.org/debian-python/2008/02/msg00033.html [2] http://lists.debian.org/debian-python/2008/02/msg00045.html
#! /bin/sh # # Update link-library symlinks after a Python default runtime change set -e version=1_34_1 die() { echo "$@" >&2 exit 1 } update_linklibs() { py=$1 suf=$2 cd /usr/lib for thread in "" -mt; do for gcc in gcc41 gcc42; do ln -s -f libboost_python-${gcc}${thread}${debug}-${version}-${py}.${suf} \ libboost_python-${gcc}${thread}${debug}-${version}.${suf} done ln -s -f libboost_python${thread}${debug}-${py}.${suf} \ libboost_python${thread}${debug}.${suf} done } remove_linklibs() { suf=$1 cd /usr/lib for thread in "" -mt; do for gcc in gcc41 gcc42; do rm -f libboost_python-${gcc}${thread}${debug}-${version}.${suf} done rm -f libboost_python${thread}${debug}.${suf} done } rtupdate() { case "$1" in python2.4) py=py24 ;; python2.5) py=py25 ;; *) die $0 unknown python version $1 ;; esac update_linklibs $py a update_linklibs $py so } remove() { remove_linklibs a remove_linklibs so } if [ "$1" = "-d" ]; then debug=-d shift fi action="$1" shift case "$action" in pre-rtupdate) ;; post-rtupdate) ;; rtupdate) rtupdate $1 ;; remove) remove ;; *) die "$0 called with unknown argument '$action'" ;; esac
signature.asc
Description: Digital signature