Skip to content

Instantly share code, notes, and snippets.

@k0001
Created June 3, 2010 05:18
Show Gist options
  • Save k0001/423501 to your computer and use it in GitHub Desktop.
Save k0001/423501 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This scripts installs into the current active Python virtualenv:
# - pygobject-2.12.1
# - pygtk-2.10.1
# - pushd pycairo-1.2.0
DATADIR=/tmp/py24gtk-data
WORKDIR=`mktemp -d`
check()
{
if [ "x$VIRTUAL_ENV" == "x" ] ; then
die "You are not inside a python virtualenv!"
else
echo "Python virtualenv: $VIRTUAL_ENV"
if [ "x$PYTHON" == "x" ] ; then
export PYTHON="$VIRTUAL_ENV/bin/python"
fi
if [ ! -f "$PYTHON" ] ; then
die "Python interpreter not found (try setting PYTHON environment variable): $PYTHON"
else
echo "Python interpreter: $PYTHON"
fi
fi
}
# PyGOobject
install_pygobject()
{
wget -c http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.12/pygobject-2.12.1.tar.bz2 \
-O $DATADIR/pygobject-2.12.1.tar.bz2
tar xvjf $DATADIR/pygobject-2.12.1.tar.bz2
pushd pygobject-2.12.1
./configure --prefix=$VIRTUAL_ENV || die
cat << EOF | patch -p0 -l || die
--- libtool 2010-06-03 14:59:23.653685294 -0300
+++ libtool.2 2010-06-03 14:59:20.670350338 -0300
@@ -268,3 +268,3 @@
# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
+global_symbol_pipe="sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1\2\3 \3/p'"
EOF
make && \
make install || die "PyGObject install failed"
popd
}
# PyGTK
install_pygtk()
{
wget -c http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.10/pygtk-2.10.1.tar.bz2 \
-O $DATADIR/pygtk-2.10.1.tar.bz2
tar xvjf $DATADIR/pygtk-2.10.1.tar.bz2
pushd pygtk-2.10.1
./configure --prefix=$VIRTUAL_ENV && \
make && \
make install || die "PyGTK install failed"
popd
}
# PyCairo
install_pycairo()
{
wget -c http://cairographics.org/releases/pycairo-1.2.0.tar.gz \
-O $DATADIR/pycairo-1.2.0.tar.gz
tar xvzf $DATADIR/pycairo-1.2.0.tar.gz
pushd pycairo-1.2.0
./configure --prefix=$VIRTUAL_ENV && \
make && \
make install || die "PyCairo install failed"
popd
}
die()
{
echo "$1" > /dev/stderr
exit 1;
}
check
mkdir -p $DATADIR
pushd $WORKDIR
echo "Working in $WORKDIR"
install_pygobject
install_pygtk
install_pycairo
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment