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.
This commit is contained in:
Eberhard Beilharz 2025-03-18 11:11:06 +01:00
parent 3346a31115
commit 5ccbb65be2
No known key found for this signature in database
GPG key ID: E9140597606020D3
3 changed files with 16 additions and 5 deletions

View file

@ -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,

View file

@ -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)

View file

@ -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() {