Files
nixpkgs/pkgs/development/python-modules/dbus-python/default.nix
Jan Tojnar 0e7f37444a python3Packages.dbus-python: Re-enable tests
This was missed in f2355396ea.

`tests` option switched to `feature` type, which mapped the old `true` value to `auto`:
  37c3f5a1f6

Additionally, a `pygobject3` dependency has been introduced, which causes the `auto`-enabled tests to be disabled when missing:
1614ee768e
2026-07-11 11:13:32 +02:00

114 lines
2.5 KiB
Nix

{
lib,
fetchPypi,
buildPythonPackage,
fetchpatch,
isPyPy,
python,
# build-system
meson,
meson-python,
pkg-config,
# native dependencies
dbus,
dbus-glib,
# test dependencies
pygobject3,
}:
buildPythonPackage (finalAttrs: {
pname = "dbus-python";
version = "1.4.0";
pyproject = true;
disabled = isPyPy;
outputs = [
"out"
"dev"
];
src = fetchPypi {
pname = "dbus-python";
inherit (finalAttrs) version;
hash = "sha256-mRZm5Jj2Db8+Sbi3Z49VWbimUDT99hquYs3s232Jx3A=";
};
patches = [
# reduce required dependencies
# https://gitlab.freedesktop.org/dbus/dbus-python/-/merge_requests/23
(fetchpatch {
url = "https://gitlab.freedesktop.org/dbus/dbus-python/-/commit/d5e19698a8d6e1485f05b67a5b2daa2392819aaf.patch";
hash = "sha256-Rmj/ByRLiLnIF3JsMBElJugxsG8IARcBdixLhoWgIYU=";
})
# Fix on Python 3.15, the patch did not achieve what it aimed for anyway.
# https://gitlab.freedesktop.org/dbus/dbus-python/-/work_items/59
(fetchpatch {
url = "https://gitlab.freedesktop.org/dbus/dbus-python/-/commit/ebecd1747c382a57ad8e47d0e32112cdbd454b40.patch";
hash = "sha256-Hg4o+FPJvQ1/RW9fd8UJg/YEeVOvbJCov7SS7bT0vvs=";
revert = true;
})
];
postPatch = ''
# we provide patchelf natively, not through the python package
sed -i '/patchelf/d' pyproject.toml
patchShebangs test/*.sh
'';
nativeBuildInputs = [
dbus # build systems checks for `dbus-run-session` in PATH
meson
meson-python
pkg-config
];
buildInputs = [
dbus
dbus-glib
];
checkInputs = [
pygobject3
];
mesonFlags = [
(lib.mesonEnable "tests" finalAttrs.finalPackage.doInstallCheck)
];
# workaround bug in meson-python
# https://github.com/mesonbuild/meson-python/issues/240
postInstall = ''
mkdir -p $dev/lib
mv $out/${python.sitePackages}/.dbus_python.mesonpy.libs/pkgconfig/ $dev/lib
'';
# make sure the Cflags in the pkgconfig file are correct and make the structure backwards compatible
postFixup = ''
ln -s $dev/include/*/dbus_python/dbus-1.0/ $dev/include/dbus-1.0
'';
nativeCheckInputs = [ dbus.out ];
checkPhase = ''
runHook preCheck
meson test -C build --no-rebuild --print-errorlogs --timeout-multiplier 0
runHook postCheck
'';
meta = {
description = "Python DBus bindings";
homepage = "https://gitlab.freedesktop.org/dbus/dbus-python";
license = lib.licenses.mit;
platforms = dbus.meta.platforms;
maintainers = [ ];
};
})