2021-05-23 21:42:27 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
set -x
|
|
|
|
|
2021-05-30 00:16:28 +03:00
|
|
|
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
prjdir="$( cd "${dir}/../.." && pwd )"
|
2021-05-23 21:42:27 +03:00
|
|
|
|
|
|
|
# Find psycopg version
|
2021-05-30 00:16:28 +03:00
|
|
|
version=$(grep -e ^PSYCOPG_VERSION setup.py | sed "s/.*'\(.*\)'/\1/")
|
2021-05-23 21:42:27 +03:00
|
|
|
# A gratuitous comment to fix broken vim syntax file: '")
|
2023-04-02 13:59:29 +03:00
|
|
|
distdir="${prjdir}/dist"
|
2021-05-23 21:42:27 +03:00
|
|
|
|
|
|
|
# Replace the package name
|
|
|
|
if [[ "${PACKAGE_NAME:-}" ]]; then
|
|
|
|
sed -i "s/^setup(name=\"psycopg2\"/setup(name=\"${PACKAGE_NAME}\"/" \
|
2021-05-30 00:16:28 +03:00
|
|
|
"${prjdir}/setup.py"
|
2021-05-23 21:42:27 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Build the source package
|
2021-05-30 00:16:28 +03:00
|
|
|
python setup.py sdist -d "$distdir"
|
2021-05-23 21:42:27 +03:00
|
|
|
|
|
|
|
# install and test
|
2021-05-30 00:16:28 +03:00
|
|
|
pip install "${distdir}"/*.tar.gz
|
2021-05-23 21:42:27 +03:00
|
|
|
|
|
|
|
python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|