From c7115c1fc3aec28b024a75c8fbe4010bb23bdaae Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sat, 5 Apr 2025 02:43:24 +0200 Subject: [PATCH] python313Packages.slixmpp: fix build and modernize --- .../python-modules/slixmpp/default.nix | 48 ++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/slixmpp/default.nix b/pkgs/development/python-modules/slixmpp/default.nix index cad4defb2dfb..1a7d410e790d 100644 --- a/pkgs/development/python-modules/slixmpp/default.nix +++ b/pkgs/development/python-modules/slixmpp/default.nix @@ -3,19 +3,23 @@ buildPythonPackage, aiodns, aiohttp, + cryptography, + defusedxml, + emoji, fetchPypi, gnupg, pyasn1, pyasn1-modules, pytestCheckHook, replaceVars, + rustPlatform, pythonOlder, }: buildPythonPackage rec { pname = "slixmpp"; version = "1.10.0"; - format = "setuptools"; + pyproject = true; disabled = pythonOlder "3.9"; @@ -24,25 +28,47 @@ buildPythonPackage rec { hash = "sha256-RrxdAVB8tChcglXOXHF8C19o5U38HxcSiDmY1tciV4o="; }; - propagatedBuildInputs = [ - aiodns - aiohttp - pyasn1 - pyasn1-modules - ]; - - nativeCheckInputs = [ pytestCheckHook ]; - patches = [ (replaceVars ./hardcode-gnupg-path.patch { inherit gnupg; }) ]; + build-system = with rustPlatform; [ + cargoSetupHook + maturinBuildHook + ]; + + cargoDeps = rustPlatform.fetchCargoVendor { + inherit pname src; + hash = "sha256-CeuClBYEG2YCm5lnxFs5RhjIgYEOe76rzHpauLZeQR0="; + }; + + dependencies = [ + aiodns + pyasn1 + pyasn1-modules + ]; + + optional-dependencies = { + xep-0363 = [ aiohttp ]; + xep-0444-compliance = [ emoji ]; + xep-0464 = [ cryptography ]; + safer-xml-parserig = [ defusedxml ]; + }; + + nativeCheckInputs = [ pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies); + + preCheck = '' + # don't test against pure python version in the source tree + rm -rf slixmpp + ''; + disabledTestPaths = [ + # Exclude integration tests + "itests/" # Exclude live tests "tests/live_test.py" - "tests/test_xep_0454.py" ]; pythonImportsCheck = [ "slixmpp" ];