python311Packages.dbus-python: 1.2.18 -> 1.3.2

Migrates the build from autotools to meson-python.

Co-Authored-By: adisbladis <adisbladis@gmail.com>
Co-Authored-By: Sandro Jäckel <sandro.jaeckel@gmail.com>
This commit is contained in:
Martin Weinelt 2023-12-04 03:13:01 +01:00
parent 9f42d2382e
commit 275ba0f1cb
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 73 additions and 29 deletions

View File

@ -1,47 +1,99 @@
{ lib, stdenv, fetchPypi, buildPythonPackage, python, pkg-config, dbus, dbus-glib, isPyPy { lib
, ncurses, pygobject3, isPy3k, pythonAtLeast }: , fetchPypi
, buildPythonPackage
, fetchpatch
, isPyPy
, python
# build-system
, meson
, meson-python
, pkg-config
# native dependencies
, dbus
, dbus-glib
}:
buildPythonPackage rec { buildPythonPackage rec {
pname = "dbus-python"; pname = "dbus-python";
version = "1.2.18"; version = "1.3.2";
pyproject = true;
# ModuleNotFoundError: No module named 'distutils' disabled = isPyPy;
disabled = isPyPy || pythonAtLeast "3.12";
format = "other"; outputs = [
outputs = [ "out" "dev" ]; "out"
"dev"
];
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "0q3jrw515z98mqdk9x822nd95rky455zz9876f1nqna5igkd3gcj"; hash = "sha256-rWeBkwhhi1BpU3viN/jmjKHH/Mle5KEh/mhFsUGCSPg=";
}; };
patches = [ patches = [
./fix-includedir.patch # 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=";
})
]; ];
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) '' postPatch = ''
MACOSX_DEPLOYMENT_TARGET=10.16 # 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
''; '';
configureFlags = [ nativeBuildInputs = [
"PYTHON=${python.pythonOnBuildForHost.interpreter}" meson
meson-python
pkg-config
]; ];
nativeBuildInputs = [ pkg-config ]; buildInputs = [
buildInputs = [ dbus dbus-glib ] dbus
# My guess why it's sometimes trying to -lncurses. dbus-glib
# It seems not to retain the dependency anyway. ];
++ lib.optional (! python ? modules) ncurses;
doCheck = isPy3k; pypaBuildFlags = [
nativeCheckInputs = [ dbus.out pygobject3 ]; # Don't discard meson build directory, still needed for tests!
"-Cbuild-dir=_meson-build"
];
# workaround bug in meson-python
# https://github.com/mesonbuild/meson-python/issues/240
postInstall = '' postInstall = ''
cp -r dbus_python.egg-info $out/${python.sitePackages}/ 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
''; '';
meta = with lib; { meta = with lib; {
description = "Python DBus bindings"; description = "Python DBus bindings";
homepage = "https://gitlab.freedesktop.org/dbus/dbus-python";
license = licenses.mit; license = licenses.mit;
platforms = dbus.meta.platforms; platforms = dbus.meta.platforms;
maintainers = with maintainers; [ ]; maintainers = with maintainers; [ ];

View File

@ -1,8 +0,0 @@
--- a/dbus-python.pc.in
+++ b/dbus-python.pc.in
@@ -9,4 +9,4 @@
Description: Python bindings for D-Bus
Requires: dbus-1 >= 1.0
Version: @VERSION@
-Cflags: -I${includedir}
+Cflags: -I${includedir}/dbus-1.0