1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 cython,
8 poetry-core,
9 setuptools,
10 numpy,
11 pydicom,
12 pylibjpeg-data,
13 pylibjpeg,
14}:
15
16let
17 self = buildPythonPackage {
18 pname = "pylibjpeg-libjpeg";
19 version = "2.3.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchFromGitHub {
25 owner = "pydicom";
26 repo = "pylibjpeg-libjpeg";
27 tag = "v${self.version}";
28 hash = "sha256-xqSA1cutTsH9k4l9CW96n/CURzkAyDi3PZylZeedVjA=";
29 fetchSubmodules = true;
30 };
31
32 postPatch = ''
33 substituteInPlace pyproject.toml \
34 --replace-fail 'poetry-core >=1.8,<2' 'poetry-core'
35 '';
36
37 build-system = [
38 cython
39 poetry-core
40 setuptools
41 ];
42
43 dependencies = [ numpy ];
44
45 nativeCheckInputs = [
46 pydicom
47 pylibjpeg-data
48 pylibjpeg
49 pytestCheckHook
50 ];
51
52 doCheck = false; # circular test dependency with `pylibjpeg` and `pydicom`
53
54 passthru.tests.check = self.overridePythonAttrs (_: {
55 doCheck = true;
56 });
57
58 pythonImportsCheck = [ "libjpeg" ];
59
60 meta = {
61 description = "JPEG, JPEG-LS and JPEG XT plugin for pylibjpeg";
62 homepage = "https://github.com/pydicom/pylibjpeg-libjpeg";
63 changelog = "https://github.com/pydicom/pylibjpeg-libjpeg/releases/tag/v${self.version}";
64 license = lib.licenses.gpl3Only;
65 maintainers = with lib.maintainers; [ bcdarwin ];
66 };
67 };
68in
69self