From afd3d08e72c3e081d37cf319a8922894b11ba126 Mon Sep 17 00:00:00 2001 From: Ben North Date: Sat, 23 May 2020 09:41:15 +0100 Subject: [PATCH] Add script testing that sdist result works It was quite fiddly to get something which works both locally and, looking ahead, on the Travis infrastructure. See https://github.com/travis-ci/travis-ci/issues/8589 --- tests/test-sdist.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tests/test-sdist.sh diff --git a/tests/test-sdist.sh b/tests/test-sdist.sh new file mode 100755 index 0000000..09bf327 --- /dev/null +++ b/tests/test-sdist.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -x + +PYTHON_VER=$(python3 -c 'if True: + import sys + v = sys.version_info + print(".".join(map(str,[v.major,v.minor,v.micro])))') + +OPT_PYTHON=/opt/python/$PYTHON_VER/bin/python3 +if [ -x $OPT_PYTHON ]; then + PYTHON=$OPT_PYTHON +else + PYTHON=$(which python3) +fi + +D=$(mktemp -d) +function rm_tmpdir { + rm -rf "$D" +} +trap rm_tmpdir EXIT + +SRCDIR=$(pwd) + +python3 setup.py sdist -d $D \ + && $PYTHON -m venv $D \ + && cd / \ + && ( source $D/bin/activate \ + && python3 -m ensurepip \ + && pip3 install -r "$SRCDIR"/requirements.txt \ + && pip3 install $D/gitdendrify-*.tar.gz ) \ + && echo Success +