1{
2 lib,
3 buildPythonPackage,
4 aiodns,
5 aiohttp,
6 cryptography,
7 defusedxml,
8 emoji,
9 fetchPypi,
10 gnupg,
11 pyasn1,
12 pyasn1-modules,
13 pytestCheckHook,
14 replaceVars,
15 rustPlatform,
16 pythonOlder,
17}:
18
19buildPythonPackage rec {
20 pname = "slixmpp";
21 version = "1.11.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-hQxfOxlkpQdCWlGSdotZY6eHkJr6M3xkkRv4bR0urPM=";
29 };
30
31 patches = [
32 (replaceVars ./hardcode-gnupg-path.patch {
33 inherit gnupg;
34 })
35 ];
36
37 build-system = with rustPlatform; [
38 cargoSetupHook
39 maturinBuildHook
40 ];
41
42 cargoDeps = rustPlatform.fetchCargoVendor {
43 inherit pname src;
44 hash = "sha256-z0X9s36n1p31boxoe6Er0Ieirinaehoucsi89oDAS0c=";
45 };
46
47 dependencies = [
48 aiodns
49 pyasn1
50 pyasn1-modules
51 ];
52
53 optional-dependencies = {
54 xep-0363 = [ aiohttp ];
55 xep-0444-compliance = [ emoji ];
56 xep-0464 = [ cryptography ];
57 safer-xml-parserig = [ defusedxml ];
58 };
59
60 nativeCheckInputs = [ pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies);
61
62 preCheck = ''
63 # don't test against pure python version in the source tree
64 rm -rf slixmpp
65 '';
66
67 disabledTestPaths = [
68 # Exclude integration tests
69 "itests/"
70 # Exclude live tests
71 "tests/live_test.py"
72 ];
73
74 pythonImportsCheck = [ "slixmpp" ];
75
76 meta = with lib; {
77 description = "Python library for XMPP";
78 homepage = "https://slixmpp.readthedocs.io/";
79 changelog = "https://codeberg.org/poezio/slixmpp/releases/tag/slix-${version}";
80 license = licenses.mit;
81 maintainers = with maintainers; [ fab ];
82 };
83}