summary refs log tree commit diff
path: root/debian/build_virtualenv
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-01-23 17:27:49 +0000
committerErik Johnston <erik@matrix.org>2019-01-23 17:27:49 +0000
commit2a8edbaf74eec2e73634c40ecd9f1faa79b472c2 (patch)
tree00211aef7f4d7f5799b2104ed9d30ba05df635bf /debian/build_virtualenv
parentMerge branch 'erikj/msc_1813' into erikj/require_format_version (diff)
parentNewsfile (diff)
downloadsynapse-2a8edbaf74eec2e73634c40ecd9f1faa79b472c2.tar.xz
Merge branch 'erikj/get_pdu_versions' into erikj/require_format_version
Diffstat (limited to 'debian/build_virtualenv')
-rwxr-xr-xdebian/build_virtualenv15
1 files changed, 14 insertions, 1 deletions
diff --git a/debian/build_virtualenv b/debian/build_virtualenv
index 83346c40f1..8b51b9e074 100755
--- a/debian/build_virtualenv
+++ b/debian/build_virtualenv
@@ -6,7 +6,16 @@
 set -e
 
 export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs
-SNAKE=/usr/bin/python3
+
+# 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
@@ -46,3 +55,7 @@ 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