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}:
14
15buildPythonPackage rec {
16 pname = "pylibjpeg";
17 version = "2.0.1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "pydicom";
24 repo = "pylibjpeg";
25 tag = "v${version}";
26 hash = "sha256-MA1A/hTIx95MYZ2LGOifnHn77wbv0ydAgQSzNZRykVg=";
27 };
28
29 build-system = [ flit-core ];
30
31 dependencies = [ numpy ];
32
33 optional-dependencies = {
34 libjpeg = [ pylibjpeg-libjpeg ];
35 openjpeg = [ pylibjpeg-openjpeg ];
36 #rle = [ pylibjpeg-rle ]; # not in Nixpkgs
37 };
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 pydicom
42 pylibjpeg-data
43 pylibjpeg-libjpeg
44 ];
45
46 pythonImportsCheck = [ "pylibjpeg" ];
47
48 meta = with lib; {
49 description = "Python framework for decoding JPEG images, with a focus on supporting Pydicom";
50 homepage = "https://github.com/pydicom/pylibjpeg";
51 changelog = "https://github.com/pydicom/pylibjpeg/releases/tag/v${version}";
52 license = licenses.mit;
53 maintainers = with maintainers; [ bcdarwin ];
54 };
55}