nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 cython,
7 poetry-core,
8 setuptools,
9 numpy,
10 pydicom,
11 pylibjpeg-data,
12 pylibjpeg,
13 libjpeg-tools,
14}:
15
16let
17 self = buildPythonPackage {
18 pname = "pylibjpeg-libjpeg";
19 version = "2.3.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "pydicom";
24 repo = "pylibjpeg-libjpeg";
25 tag = "v${self.version}";
26 hash = "sha256-P01pofPLTOa5ynsCkLnxiMzVfCg4tbT+/CcpPTeSViw=";
27 };
28
29 postPatch = ''
30 substituteInPlace pyproject.toml \
31 --replace-fail 'poetry-core >=1.8,<2' 'poetry-core'
32 rmdir lib/libjpeg
33 cp -r ${libjpeg-tools.src} lib/libjpeg
34 chmod u+w lib/libjpeg
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