Date

Bill.. Why are you building python on ubuntu.. Doesn't it ship with a perfectly good version (you might ask)?

Well it turns out that the version that both debian and Ubuntu ship doesn't include the windows installer stubs that we use for the SCons project's windows installers. So while I could copy the files into the right place, I'm not comfortable munging the system installed packages and it (should have) be(en) an easy job to just install from source and use that.

Well it turns out if you omit the "rpath.." below, you will get a strange error when building the libxslt python library about missing the xml.sax.expatreader. This is caused by the binary picking up the system installed python expat shared object instead of the one we just built. Debugging this to failing to load the shared object in question required a little detective work in finding the actual exception which propagated up to issue that message. Once I found that, I got a symbol missing error and from there it wasn't too hard to figure out the cause and solution.

Now that I've done the hard work, here's a recipe to build it properly for yourself.

set base_dir=$HOME/tools
set python_dir=python-2.7.10
set kits_dir=${base_dir}/kits
set install_dir=${base_dir}/${python_dir}

mkdir -p ${base_dir}/${python_dir}/lib
mkdir -p ${kits_dir}


sudo apt-get install build-essential
sudo apt-get build-dep python2.7

pushd ${kits_dir}
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.28.tar.gz

tar xvfz Python-2.7.10.tgz
tar xvfz libxml2-2.9.2.tar.gz
tar xvfz libxslt-1.1.28.tar.gz

export PATH=${install_dir}/bin:$PATH
mkdir -p ${install_dir}/lib

pushd Python-2.7.10
LDFLAGS="-Wl,-rpath=$HOME/tools/python-2.7.10/lib" ./configure --prefix=${install_dir} --enable-shared --enable-unicode
make
make install
popd

pushd libxml2-2.9.2
LDFLAGS="-Wl,-rpath=$HOME/tools/python-2.7.10/lib" ./configure --prefix=${install_dir} --enable-shared
make
make install
popd

pushd libxslt-1.1.8
LDFLAGS="-Wl,-rpath=$HOME/tools/python-2.7.10/lib" ./configure --prefix=${install_dir} --enable-shared
make
make install
popd


wget https://bootstrap.pypa.io/ez_setup.py -O - | python