mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 18:33:44 +03:00
ec531bee31
Adapted from the psycopg2-wheels project
27 lines
697 B
Bash
Executable File
27 lines
697 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
set -x
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
PRJDIR="$( cd "${DIR}/../.." && pwd )"
|
|
|
|
# Find psycopg version
|
|
export VERSION=$(grep -e ^PSYCOPG_VERSION setup.py | sed "s/.*'\(.*\)'/\1/")
|
|
# A gratuitous comment to fix broken vim syntax file: '")
|
|
export DISTDIR="${PRJDIR}/dist/psycopg2-$VERSION"
|
|
|
|
# Replace the package name
|
|
if [[ "${PACKAGE_NAME:-}" ]]; then
|
|
sed -i "s/^setup(name=\"psycopg2\"/setup(name=\"${PACKAGE_NAME}\"/" \
|
|
setup.py
|
|
fi
|
|
|
|
# Build the source package
|
|
python setup.py sdist -d "$DISTDIR"
|
|
|
|
# install and test
|
|
pip install "${DISTDIR}"/*.tar.gz
|
|
|
|
python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|