1
0

build_virtualenv 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. #
  3. # runs dh_virtualenv to build the virtualenv in the build directory,
  4. # and then runs the trial tests against the installed synapse.
  5. set -e
  6. export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs
  7. SNAKE=/usr/bin/python3
  8. # try to set the CFLAGS so any compiled C extensions are compiled with the most
  9. # generic as possible x64 instructions, so that compiling it on a new Intel chip
  10. # doesn't enable features not available on older ones or AMD.
  11. #
  12. # TODO: add similar things for non-amd64, or figure out a more generic way to
  13. # do this.
  14. case `dpkg-architecture -q DEB_HOST_ARCH` in
  15. amd64)
  16. export CFLAGS=-march=x86-64
  17. ;;
  18. esac
  19. # Use --builtin-venv to use the better `venv` module from CPython 3.4+ rather
  20. # than the 2/3 compatible `virtualenv`.
  21. dh_virtualenv \
  22. --install-suffix "matrix-synapse" \
  23. --builtin-venv \
  24. --setuptools \
  25. --python "$SNAKE" \
  26. --upgrade-pip \
  27. --preinstall="lxml" \
  28. --preinstall="mock" \
  29. --extra-pip-arg="--no-cache-dir" \
  30. --extra-pip-arg="--compile" \
  31. --extras="all"
  32. # we copy the tests to a temporary directory so that we can put them on the
  33. # PYTHONPATH without putting the uninstalled synapse on the pythonpath.
  34. tmpdir=`mktemp -d`
  35. trap "rm -r $tmpdir" EXIT
  36. cp -r tests "$tmpdir"
  37. PYTHONPATH="$tmpdir" \
  38. debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python \
  39. -B -m twisted.trial --reporter=text -j2 tests