nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cmake,
7 cython,
8 poetry-core,
9 setuptools,
10 numpy,
11 openjpeg,
12 pytestCheckHook,
13 pydicom,
14 pylibjpeg,
15 pylibjpeg-data,
16}:
17
18buildPythonPackage rec {
19 pname = "pylibjpeg-openjpeg";
20 version = "2.5.0";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "pydicom";
25 repo = "pylibjpeg-openjpeg";
26 tag = "v${version}";
27 hash = "sha256-siZ/Mm1wmd7dWhGa4rdH9Frxis2jB9av/Kw2dEe5dpI=";
28 };
29
30 # don't use vendored openjpeg submodule:
31 # (note build writes into openjpeg source dir, so we have to make it writable)
32 postPatch = ''
33 rmdir lib/openjpeg
34 cp -r ${openjpeg.src} lib/openjpeg
35 chmod +rwX -R lib/openjpeg
36
37 substituteInPlace pyproject.toml --replace-fail "poetry-core >=1.8,<2" "poetry-core"
38 '';
39
40 dontUseCmakeConfigure = true;
41
42 build-system = [
43 cmake
44 cython
45 poetry-core
46 setuptools
47 ];
48
49 dependencies = [ numpy ];
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 pydicom
54 pylibjpeg-data
55 pylibjpeg
56 ];
57 disabledTestPaths = [
58 # ignore a few Python test files (e.g. performance tests) in openjpeg itself:
59 "lib/openjpeg"
60 ];
61
62 enabledTestPaths = [ "openjpeg/tests" ];
63
64 pythonImportsCheck = [ "openjpeg" ];
65
66 meta = {
67 description = "J2K and JP2 plugin for pylibjpeg";
68 homepage = "https://github.com/pydicom/pylibjpeg-openjpeg";
69 changelog = "https://github.com/pydicom/pylibjpeg-openjpeg/releases/tag/${src.tag}";
70 license = [ lib.licenses.mit ];
71 maintainers = with lib.maintainers; [ bcdarwin ];
72 # darwin: numerous test failures, test dependency pydicom is marked as unsupported
73 broken = stdenv.hostPlatform.isDarwin;
74 };
75}