mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
2f88881c93
In the debian package, make the virtualenv symlink python to /usr/bin/python3.X rather than /usr/bin/python3. Also make sure we depend on the right python3.x package. This might help a bit with subtle failures when people install a package from the wrong distro (https://github.com/matrix-org/synapse/issues/4431).
62 lines
1.9 KiB
Bash
Executable File
62 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# runs dh_virtualenv to build the virtualenv in the build directory,
|
|
# and then runs the trial tests against the installed synapse.
|
|
|
|
set -e
|
|
|
|
export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs
|
|
|
|
# make sure that the virtualenv links to the specific version of python, by
|
|
# dereferencing the python3 symlink.
|
|
#
|
|
# Otherwise, if somebody tries to install (say) the stretch package on buster,
|
|
# they will get a confusing error about "No module named 'synapse'", because
|
|
# python won't look in the right directory. At least this way, the error will
|
|
# be a *bit* more obvious.
|
|
#
|
|
SNAKE=`readlink -e /usr/bin/python3`
|
|
|
|
# try to set the CFLAGS so any compiled C extensions are compiled with the most
|
|
# generic as possible x64 instructions, so that compiling it on a new Intel chip
|
|
# doesn't enable features not available on older ones or AMD.
|
|
#
|
|
# TODO: add similar things for non-amd64, or figure out a more generic way to
|
|
# do this.
|
|
|
|
case `dpkg-architecture -q DEB_HOST_ARCH` in
|
|
amd64)
|
|
export CFLAGS=-march=x86-64
|
|
;;
|
|
esac
|
|
|
|
# Use --builtin-venv to use the better `venv` module from CPython 3.4+ rather
|
|
# than the 2/3 compatible `virtualenv`.
|
|
|
|
dh_virtualenv \
|
|
--install-suffix "matrix-synapse" \
|
|
--builtin-venv \
|
|
--setuptools \
|
|
--python "$SNAKE" \
|
|
--upgrade-pip \
|
|
--preinstall="lxml" \
|
|
--preinstall="mock" \
|
|
--extra-pip-arg="--no-cache-dir" \
|
|
--extra-pip-arg="--compile" \
|
|
--extras="all"
|
|
|
|
# we copy the tests to a temporary directory so that we can put them on the
|
|
# PYTHONPATH without putting the uninstalled synapse on the pythonpath.
|
|
tmpdir=`mktemp -d`
|
|
trap "rm -r $tmpdir" EXIT
|
|
|
|
cp -r tests "$tmpdir"
|
|
|
|
PYTHONPATH="$tmpdir" \
|
|
debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python \
|
|
-B -m twisted.trial --reporter=text -j2 tests
|
|
|
|
# add a dependency on the right version of python to substvars.
|
|
PYPKG=`basename $SNAKE`
|
|
echo "synapse:pydepends=$PYPKG" >> debian/matrix-synapse-py3.substvars
|