1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pydicom,
8 pyfakefs,
9 pytestCheckHook,
10 pythonAtLeast,
11 pythonOlder,
12 setuptools,
13 sqlalchemy,
14}:
15
16buildPythonPackage rec {
17 pname = "pynetdicom";
18 version = "2.0.2";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "pydicom";
25 repo = "pynetdicom";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-/JWQUtFBW4uqCbs/nUxj1pRBfTCXV4wcqTkqvzpdFrM=";
28 };
29
30 patches = [
31 (fetchpatch {
32 name = "fix-python-3.11-test-attribute-errors.patch";
33 url = "https://github.com/pydicom/pynetdicom/pull/754/commits/2126bd932d6dfb3f07045eb9400acb7eaa1b3069.patch";
34 hash = "sha256-t6Lg0sTZSWIE5q5pkBvEoHDQ+cklDn8SgNBcFk1myp4=";
35 })
36 (fetchpatch {
37 # https://github.com/pydicom/pynetdicom/pull/848
38 name = "replace-setup-with-setup_method1.patch";
39 url = "https://github.com/pydicom/pynetdicom/commit/09b4e0901445d46868668bc69a7b4f7f00cf6cbb.patch";
40 hash = "sha256-1ea1A/LU6qY+hd23b6H4OkKHQ0hI2/MYgBgZUZE0kRU=";
41 })
42 (fetchpatch {
43 # https://github.com/pydicom/pynetdicom/pull/848
44 name = "replace-setup-with-setup_method2.patch";
45 url = "https://github.com/pydicom/pynetdicom/commit/3966c2d749eeda718caccf9a88a0495d1823825d.patch";
46 hash = "sha256-C4MSfwwxDgr5T0XQMlR5j2wElPu83TqPhjyNDvfBjJs=";
47 })
48 ];
49
50 build-system = [ setuptools ];
51
52 dependencies = [ pydicom ];
53
54 nativeCheckInputs = [
55 pyfakefs
56 pytestCheckHook
57 sqlalchemy
58 ];
59
60 disabledTests = [
61 # Some tests needs network capabilities
62 "test_str_types_empty"
63 "test_associate_reject"
64 "TestAEGoodAssociation"
65 "TestEchoSCP"
66 "TestEchoSCPCLI"
67 "TestEventHandlingAcceptor"
68 "TestEventHandlingRequestor"
69 "TestFindSCP"
70 "TestFindSCPCLI"
71 "TestGetSCP"
72 "TestGetSCPCLI"
73 "TestMoveSCP"
74 "TestMoveSCPCLI"
75 "TestPrimitive_N_GET"
76 "TestQRGetServiceClass"
77 "TestQRMoveServiceClass"
78 "TestSearch"
79 "TestState"
80 "TestStorageServiceClass"
81 "TestStoreSCP"
82 "TestStoreSCPCLI"
83 "TestStoreSCU"
84 "TestStoreSCUCLI"
85 ];
86
87 disabledTestPaths =
88 [
89 # Ignore apps tests
90 "pynetdicom/apps/tests/"
91 ]
92 ++ lib.optionals (pythonAtLeast "3.12") [
93 # https://github.com/pydicom/pynetdicom/issues/924
94 "pynetdicom/tests/test_assoc.py"
95 "pynetdicom/tests/test_transport.py"
96 ];
97
98 pythonImportsCheck = [ "pynetdicom" ];
99
100 pytestFlagsArray = [
101 # https://github.com/pydicom/pynetdicom/issues/923
102 "-W"
103 "ignore::pytest.PytestRemovedIn9Warning"
104 ];
105
106 meta = with lib; {
107 description = "Python implementation of the DICOM networking protocol";
108 homepage = "https://github.com/pydicom/pynetdicom";
109 changelog = "https://github.com/pydicom/pynetdicom/releases/tag/v${version}";
110 license = with licenses; [ mit ];
111 maintainers = with maintainers; [ fab ];
112 # Tests are not passing on Darwin/Aarch64, thus it's assumed that it doesn't work
113 broken = stdenv.isDarwin || stdenv.isAarch64;
114 };
115}