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-14 08:57:08 +01:00
|
|
|
python setup.py build_ext
|
2022-01-12 05:28:21 +01:00
|
|
|
pip install dist/*.zip
|
2022-01-13 02:32:09 +01:00
|
|
|
|
|
|
|
pip install -Ur test-requirements.txt
|
|
|
|
|
|
|
|
if [ "$CHECK_LINT" = "1" ]; then
|
|
|
|
error=0
|
2022-01-14 08:57:08 +01:00
|
|
|
black_files="setup.py tests netfilterqueue"
|
|
|
|
if ! black --check $black_files; then
|
|
|
|
error=$?
|
|
|
|
black --diff $black_files
|
|
|
|
fi
|
|
|
|
mypy --strict -p netfilterqueue || error=$?
|
|
|
|
( mkdir empty; cd empty; python -m mypy.stubtest netfilterqueue ) || error=$?
|
|
|
|
|
|
|
|
if [ $error -ne 0 ]; then
|
2022-01-13 02:32:09 +01:00
|
|
|
cat <<EOF
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
2022-01-14 08:57:08 +01:00
|
|
|
Problems were found by static analysis (listed above).
|
|
|
|
To fix formatting and see remaining errors, run:
|
2022-01-13 02:32:09 +01:00
|
|
|
|
|
|
|
pip install -r test-requirements.txt
|
2022-01-14 08:57:08 +01:00
|
|
|
black $black_files
|
|
|
|
mypy --strict -p netfilterqueue
|
|
|
|
( mkdir empty; cd empty; python -m mypy.stubtest netfilterqueue )
|
2022-01-13 02:32:09 +01:00
|
|
|
|
|
|
|
in your local checkout.
|
|
|
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
EOF
|
2022-01-14 08:57:08 +01:00
|
|
|
exit 1
|
2022-01-13 02:32:09 +01:00
|
|
|
fi
|
2022-01-14 08:57:08 +01:00
|
|
|
exit 0
|
2022-01-13 02:32:09 +01:00
|
|
|
fi
|
2022-01-12 05:28:21 +01:00
|
|
|
|
|
|
|
cd tests
|
|
|
|
pytest -W error -ra -v .
|