From 5ccbb65be2b6d36ea9f3f122d068c81ab435f264 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 18 Mar 2025 11:11:06 +0100 Subject: [PATCH] chore(linux): some more replacements of setup.py The recommended replacement for `setup.py build` is to use the `build` module, so we have to add this as additional build dependency. This change also removes the `devdist` target from the makefile - it isn't referenced in any script, so I think we can do without. Unfortunately the `python3-build` package available on Ubuntu 22.04 Jammy is buggy and looks for `/usr/local/bin/python` so we can't use that. Instead we continue to use `setup.py` for building on Jammy. --- linux/debian/control | 2 ++ linux/keyman-config/Makefile | 10 ++++++---- linux/keyman-config/build.sh | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/linux/debian/control b/linux/debian/control index 30cd2271b7..09e9f89086 100644 --- a/linux/debian/control +++ b/linux/debian/control @@ -25,6 +25,7 @@ Build-Depends: perl, pkgconf, python3-all (>= 3.5), + python3-build, python3-dbus, python3-fonttools, python3-gi, @@ -39,6 +40,7 @@ Build-Depends: python3-requests, python3-sentry-sdk (>= 1.1), python3-setuptools, + python3-venv, python3-xdg, xserver-xephyr, xvfb, diff --git a/linux/keyman-config/Makefile b/linux/keyman-config/Makefile index d36bf16a0f..ad5b0d2c53 100644 --- a/linux/keyman-config/Makefile +++ b/linux/keyman-config/Makefile @@ -15,11 +15,13 @@ clean: check: ./build.sh test -devdist: version - python3 setup.py egg_info -b.`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M` sdist - dist: clean version - python3 setup.py sdist + # TODO: remove this if when we no longer support Ubuntu 22.04 Jammy + if dpkg --compare-versions "$(lsb_release -r -s)" lt 24.04; then \ + python3 setup.py sdist ; \ + else \ + python3 -m build --outdir build --sdist ; \ + fi deb: dist @VERSION=$(shell echo `basename dist/*.gz .tar.gz|cut -d "-" -f2` > /tmp/keyman_version) diff --git a/linux/keyman-config/build.sh b/linux/keyman-config/build.sh index f121084cc3..b4b4bd0377 100755 --- a/linux/keyman-config/build.sh +++ b/linux/keyman-config/build.sh @@ -83,7 +83,14 @@ build_action() { builder_echo "Building man and help pages" build_man_and_help_pages builder_echo "Building keyman-config" - python3 setup.py build + # we use `dpkg --compare-versions` to compare the current Ubuntu version + if dpkg --compare-versions "$(lsb_release -r -s)" lt 24.04; then + # Ubuntu 22.04 Jammy has a buggy version of python3-build which doesn't work + # TODO: remove once we drop support for Ubuntu 22.04 Jammy + python3 setup.py build + else + python3 -m build --outdir build . + fi } test_action() {