Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 6b3e0ea

Browse files
David RobertsoncallahadH-Shay
authored
Use poetry to manage the virtualenv in debian packages (#12449)
* Use `poetry` to build venv in debian packages Co-authored-by: Dan Callahan <[email protected]> Co-authored-by: Shay <[email protected]> * Changelog * Only pull in from requirements.txt Addresses the same problem as #12439. * Include `test` and `all` extras `poetry export` helpfully silently ignores an unknown extra Haven't seen this before because it's the only place we export `all` and `test`. I could have __sworm__ that the syntax `--extra "all test"` worked for `poetry install`... * Clean up requirements file on subsequence builds * Fix shell syntax Co-authored-by: Dan Callahan <[email protected]> Co-authored-by: Shay <[email protected]>
1 parent 8af8a9b commit 6b3e0ea

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

changelog.d/12449.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use `poetry` to manage the virtualenv in debian packages.

debian/build_virtualenv

+16-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,19 @@ case $(dpkg-architecture -q DEB_HOST_ARCH) in
3030
;;
3131
esac
3232

33-
# Use --builtin-venv to use the better `venv` module from CPython 3.4+ rather
34-
# than the 2/3 compatible `virtualenv`.
35-
33+
# Manually install Poetry and export a pip-compatible `requirements.txt`
34+
# We need a Poetry pre-release as the export command is buggy in < 1.2
35+
TEMP_VENV="$(mktemp -d)"
36+
python3 -m venv "$TEMP_VENV"
37+
source "$TEMP_VENV/bin/activate"
38+
pip install -U pip
39+
pip install poetry==1.2.0b1
40+
poetry export --extras all --extras test -o exported_requirements.txt
41+
deactivate
42+
rm -rf "$TEMP_VENV"
43+
44+
# Use --no-deps to only install pinned versions in exported_requirements.txt,
45+
# and to avoid https://github.com/pypa/pip/issues/9644
3646
dh_virtualenv \
3747
--install-suffix "matrix-synapse" \
3848
--builtin-venv \
@@ -41,9 +51,11 @@ dh_virtualenv \
4151
--preinstall="lxml" \
4252
--preinstall="mock" \
4353
--preinstall="wheel" \
54+
--extra-pip-arg="--no-deps" \
4455
--extra-pip-arg="--no-cache-dir" \
4556
--extra-pip-arg="--compile" \
46-
--extras="all,systemd,test"
57+
--extras="all,systemd,test" \
58+
--requirements="exported_requirements.txt"
4759

4860
PACKAGE_BUILD_DIR="debian/matrix-synapse-py3"
4961
VIRTUALENV_DIR="${PACKAGE_BUILD_DIR}${DH_VIRTUALENV_INSTALL_ROOT}/matrix-synapse"

debian/changelog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
matrix-synapse-py3 (1.58.0+nmu1) UNRELEASED; urgency=medium
2+
3+
* Non-maintainer upload.
4+
* Use poetry to manage the bundled virtualenv included with this package.
5+
6+
-- Synapse Packaging Team <[email protected]> Wed, 30 Mar 2022 12:21:43 +0100
7+
18
matrix-synapse-py3 (1.57.0~rc1) stable; urgency=medium
29

310
* New synapse release 1.57.0~rc1.

debian/clean

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exported_requirements.txt

0 commit comments

Comments
 (0)