1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 cmake,
8 ninja,
9 scikit-build-core,
10 charls,
11 eigen,
12 fmt,
13 numpy,
14 pillow,
15 pybind11,
16 setuptools,
17 pathspec,
18 pyproject-metadata,
19 setuptools-scm,
20}:
21
22buildPythonPackage rec {
23 pname = "pillow-jpls";
24 version = "1.3.2";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "planetmarshall";
31 repo = "pillow-jpls";
32 tag = "v${version}";
33 hash = "sha256-Rc4/S8BrYoLdn7eHDBaoUt1Qy+h0TMAN5ixCAuRmfPU=";
34 };
35
36 env.SETUPTOOLS_SCM_PRETEND_VERSION = version;
37
38 dontUseCmakeConfigure = true;
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace-fail '"conan~=2.0.16",' "" \
43 --replace-fail '"pybind11~=2.11.1",' '"pybind11",'
44 '';
45
46 build-system = [
47 cmake
48 ninja
49 pybind11
50 scikit-build-core
51 setuptools
52 setuptools-scm
53 ];
54
55 buildInputs = [
56 charls
57 eigen
58 fmt
59 ];
60
61 dependencies = [
62 numpy
63 pillow
64 pathspec
65 pyproject-metadata
66 ];
67
68 cmakeFlags = [
69 "--preset=sysdeps"
70 ];
71
72 nativeCheckInputs = [ pytestCheckHook ];
73
74 # Prevent importing from build during test collection:
75 preCheck = ''rm -rf pillow_jpls'';
76
77 pythonImportsCheck = [ "pillow_jpls" ];
78
79 meta = with lib; {
80 description = "JPEG-LS plugin for the Python Pillow library";
81 homepage = "https://github.com/planetmarshall/pillow-jpls";
82 changelog = "https://github.com/planetmarshall/pillow-jpls/releases/tag/v${version}";
83 license = licenses.bsd3;
84 maintainers = with maintainers; [ bcdarwin ];
85 };
86}