2022-01-12 05:28:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex -o pipefail
|
|
|
|
|
|
|
|
pip install -U pip setuptools wheel
|
2022-01-12 05:31:30 +01:00
|
|
|
sudo apt-get install libnetfilter-queue-dev
|
2022-01-13 02:32:09 +01:00
|
|
|
|
2022-01-13 04:15:53 +01:00
|
|
|
# Cython is required to build the sdist...
|
|
|
|
pip install cython
|
2022-01-12 05:28:21 +01:00
|
|
|
python setup.py sdist --formats=zip
|
2022-01-13 04:15:53 +01:00
|
|
|
|
|
|
|
# ... but not to install it
|
|
|
|
pip uninstall -y cython
|
2022-01-12 05:28:21 +01:00
|
|
|
pip install dist/*.zip
|
2022-01-13 02:32:09 +01:00
|
|
|
|
|
|
|
if python --version 2>&1 | fgrep -q "Python 2.7"; then
|
|
|
|
# The testsuite doesn't run on 2.7, so do just a basic smoke test.
|
|
|
|
unshare -Urn python -c "from netfilterqueue import NetfilterQueue as NFQ; NFQ()"
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
pip install -Ur test-requirements.txt
|
|
|
|
|
|
|
|
if [ "$CHECK_LINT" = "1" ]; then
|
|
|
|
error=0
|
|
|
|
if ! black --check setup.py tests; then
|
|
|
|
cat <<EOF
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
Formatting problems were found (listed above). To fix them, run
|
|
|
|
|
|
|
|
pip install -r test-requirements.txt
|
|
|
|
black setup.py tests
|
|
|
|
|
|
|
|
in your local checkout.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
error=1
|
|
|
|
fi
|
|
|
|
if [ "$error" = "1" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
exit $error
|
|
|
|
fi
|
2022-01-12 05:28:21 +01:00
|
|
|
|
|
|
|
cd tests
|
|
|
|
pytest -W error -ra -v .
|