1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 pytestCheckHook,
8 flit-core,
9 setuptools,
10 numpy,
11 pydicom,
12 pylibjpeg-libjpeg,
13}:
14
15let
16 pylibjpeg-data = buildPythonPackage rec {
17 pname = "pylibjpeg-data";
18 version = "1.0.0dev0";
19 pyproject = true;
20
21 nativeBuildInputs = [ setuptools ];
22
23 src = fetchFromGitHub {
24 owner = "pydicom";
25 repo = "pylibjpeg-data";
26 rev = "2ab4b8a65b070656eca2582bd23197a3d01cdccd";
27 hash = "sha256-cFE1XjrqyGqwHCYGRucXK+q4k7ftUIbYwBw4WwIFtEc=";
28 };
29
30 doCheck = false;
31 };
32in
33
34buildPythonPackage rec {
35 pname = "pylibjpeg";
36 version = "2.0.0";
37 pyproject = true;
38
39 disabled = pythonOlder "3.7";
40
41 src = fetchFromGitHub {
42 owner = "pydicom";
43 repo = "pylibjpeg";
44 rev = "refs/tags/v${version}";
45 hash = "sha256-qGtrphsBBVieGS/8rdymbsjLMU/QEd7zFNAANN8bD+k=";
46 };
47
48 nativeBuildInputs = [ flit-core ];
49
50 propagatedBuildInputs = [ numpy ];
51
52 nativeCheckInputs = [
53 pytestCheckHook
54 pydicom
55 pylibjpeg-data
56 pylibjpeg-libjpeg
57 ];
58
59 pythonImportsCheck = [ "pylibjpeg" ];
60
61 meta = with lib; {
62 description = "Python framework for decoding JPEG images, with a focus on supporting Pydicom";
63 homepage = "https://github.com/pydicom/pylibjpeg";
64 changelog = "https://github.com/pydicom/pylibjpeg/releases/tag/v${version}";
65 license = licenses.mit;
66 maintainers = with maintainers; [ bcdarwin ];
67 # several test failures of form
68 # "pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header. ..."
69 broken = stdenv.isDarwin;
70 };
71}