2024-05-15 15:35:15 +00:00
|
|
|
{ lib
|
|
|
|
, fetchPypi
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchpatch
|
|
|
|
, isPyPy
|
|
|
|
, python
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
, meson
|
|
|
|
, meson-python
|
|
|
|
, pkg-config
|
|
|
|
|
|
|
|
# native dependencies
|
|
|
|
, dbus
|
|
|
|
, dbus-glib
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "dbus-python";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.3.2";
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
disabled = isPyPy;
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-rWeBkwhhi1BpU3viN/jmjKHH/Mle5KEh/mhFsUGCSPg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2024-05-15 15:35:15 +00:00
|
|
|
# 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=";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
postPatch = ''
|
|
|
|
# we provide patchelf natively, not through the python package
|
|
|
|
sed -i '/patchelf/d' pyproject.toml
|
|
|
|
|
|
|
|
# dont run autotols configure phase
|
|
|
|
rm configure.ac configure
|
|
|
|
|
|
|
|
patchShebangs test/*.sh
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
meson-python
|
|
|
|
pkg-config
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
buildInputs = [
|
|
|
|
dbus
|
|
|
|
dbus-glib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pypaBuildFlags = [
|
|
|
|
# Don't discard meson build directory, still needed for tests!
|
|
|
|
"-Cbuild-dir=_meson-build"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# workaround bug in meson-python
|
|
|
|
# https://github.com/mesonbuild/meson-python/issues/240
|
2022-08-21 13:32:41 +00:00
|
|
|
postInstall = ''
|
2024-05-15 15:35:15 +00:00
|
|
|
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 _meson-build --no-rebuild --print-errorlogs
|
|
|
|
|
|
|
|
runHook postCheck
|
2022-08-21 13:32:41 +00:00
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python DBus bindings";
|
2024-05-15 15:35:15 +00:00
|
|
|
homepage = "https://gitlab.freedesktop.org/dbus/dbus-python";
|
2022-08-12 12:06:08 +00:00
|
|
|
license = licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = dbus.meta.platforms;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|