2017-01-04 06:39:53 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Create manylinux1 wheels for psycopg2
|
|
|
|
#
|
|
|
|
# Run this script with something like:
|
|
|
|
#
|
2017-02-01 20:33:12 +03:00
|
|
|
# docker run --rm -v `pwd`:/psycopg2 quay.io/pypa/manylinux1_x86_64 /psycopg2/scripts/build-manylinux.sh
|
|
|
|
# docker run --rm -v `pwd`:/psycopg2 quay.io/pypa/manylinux1_i686 linux32 /psycopg2/scripts/build-manylinux.sh
|
2017-01-04 06:39:53 +03:00
|
|
|
#
|
2017-02-01 20:33:12 +03:00
|
|
|
# Tests run against a postgres on the host. Use -e PSYCOPG_TESTDB_USER=... etc
|
|
|
|
# to configure tests run.
|
2017-01-04 06:39:53 +03:00
|
|
|
|
|
|
|
set -e -x
|
|
|
|
|
|
|
|
# Install postgres packages for build and testing
|
|
|
|
# This doesn't work:
|
|
|
|
# rpm -Uvh "http://yum.postgresql.org/9.5/redhat/rhel-5-x86_64/pgdg-redhat95-9.5-3.noarch.rpm"
|
|
|
|
wget -O "/tmp/pgdg.rpm" "https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-5-x86_64/pgdg-centos95-9.5-3.noarch.rpm"
|
2017-02-01 20:05:47 +03:00
|
|
|
rpm -Uv "/tmp/pgdg.rpm"
|
2017-02-01 20:33:12 +03:00
|
|
|
yum install -y postgresql95-devel
|
2017-01-04 06:39:53 +03:00
|
|
|
|
|
|
|
# Make pg_config available
|
|
|
|
export PGPATH=/usr/pgsql-9.5/bin/
|
|
|
|
export PATH="$PGPATH:$PATH"
|
|
|
|
|
2017-02-01 20:05:47 +03:00
|
|
|
# Find psycopg version
|
|
|
|
export VERSION=$(grep -e ^PSYCOPG_VERSION /psycopg2/setup.py | sed "s/.*'\(.*\)'/\1/")
|
|
|
|
export WHEELSDIR="/psycopg2/wheels/psycopg2-$VERSION"
|
|
|
|
|
2017-01-04 06:39:53 +03:00
|
|
|
# Create the wheel packages
|
|
|
|
for PYBIN in /opt/python/*/bin; do
|
2017-02-01 20:05:47 +03:00
|
|
|
"${PYBIN}/pip" wheel /psycopg2/ -w "$WHEELSDIR"
|
2017-01-04 06:39:53 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
# Bundle external shared libraries into the wheels
|
2017-02-01 20:05:47 +03:00
|
|
|
for WHL in "$WHEELSDIR"/*.whl; do
|
|
|
|
auditwheel repair "$WHL" -w "$WHEELSDIR"
|
2017-01-04 06:39:53 +03:00
|
|
|
done
|
|
|
|
|
2017-02-01 20:33:12 +03:00
|
|
|
# Make sure libpq is not in the system
|
|
|
|
yum remove -y postgresql95-devel
|
2017-01-04 06:39:53 +03:00
|
|
|
|
2017-02-01 20:33:12 +03:00
|
|
|
# Connect to the host to test. Use 'docker -e' to pass other variables
|
|
|
|
export PSYCOPG2_TESTDB_HOST=$(ip route show | awk '/default/ {print $3}')
|
2017-01-04 06:39:53 +03:00
|
|
|
|
|
|
|
# Install packages and test
|
|
|
|
for PYBIN in /opt/python/*/bin; do
|
2017-02-01 20:05:47 +03:00
|
|
|
"${PYBIN}/pip" install psycopg2 --no-index -f "$WHEELSDIR"
|
2017-01-04 06:39:53 +03:00
|
|
|
"${PYBIN}/python" -c "from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|
|
|
|
done
|