1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 flit-core,
8 numpy,
9 pydicom,
10 pylibjpeg-data,
11 pylibjpeg-libjpeg,
12 pylibjpeg-openjpeg,
13 pylibjpeg-rle,
14}:
15
16buildPythonPackage rec {
17 pname = "pylibjpeg";
18 version = "2.1.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "pydicom";
25 repo = "pylibjpeg";
26 tag = "v${version}";
27 hash = "sha256-jMdNzruzr2VgEntFF5BBoK3yrq0VegtJNXAkCpHjsks=";
28 };
29
30 build-system = [ flit-core ];
31
32 dependencies = [ numpy ];
33
34 optional-dependencies =
35 let
36 extras = {
37 libjpeg = [ pylibjpeg-libjpeg ];
38 openjpeg = [ pylibjpeg-openjpeg ];
39 rle = [ pylibjpeg-rle ];
40 };
41 in
42 extras // { all = lib.concatLists (lib.attrValues extras); };
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 pydicom
47 pylibjpeg-data
48 pylibjpeg-libjpeg
49 ];
50
51 pythonImportsCheck = [ "pylibjpeg" ];
52
53 meta = with lib; {
54 description = "Python framework for decoding JPEG images, with a focus on supporting Pydicom";
55 homepage = "https://github.com/pydicom/pylibjpeg";
56 changelog = "https://github.com/pydicom/pylibjpeg/releases/tag/v${version}";
57 license = licenses.mit;
58 maintainers = with maintainers; [ bcdarwin ];
59 };
60}