about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pillow-jpls/default.nix
blob: 7aebaf432c00166db346d91afa441bed5f475916 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  pytestCheckHook,
  cmake,
  ninja,
  scikit-build-core,
  charls,
  eigen,
  fmt,
  numpy,
  pillow,
  pybind11,
  setuptools,
  pathspec,
  pyproject-metadata,
  setuptools-scm,
}:

buildPythonPackage rec {
  pname = "pillow-jpls";
  version = "1.3.2";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "planetmarshall";
    repo = "pillow-jpls";
    rev = "refs/tags/v${version}";
    hash = "sha256-Rc4/S8BrYoLdn7eHDBaoUt1Qy+h0TMAN5ixCAuRmfPU=";
  };

  env.SETUPTOOLS_SCM_PRETEND_VERSION = version;

  dontUseCmakeConfigure = true;

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"conan~=2.0.16",' "" \
      --replace-fail '"pybind11~=2.11.1",' '"pybind11",'
  '';

  build-system = [
    cmake
    ninja
    pybind11
    scikit-build-core
    setuptools
    setuptools-scm
  ];

  buildInputs = [
    charls
    eigen
    fmt
  ];

  dependencies = [
    numpy
    pillow
    pathspec
    pyproject-metadata
  ];

  pypaBuildFlags = [
    "-C"
    "cmake.args='--preset=sysdeps'"
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  # Prevent importing from build during test collection:
  preCheck = ''rm -rf pillow_jpls'';

  pythonImportsCheck = [ "pillow_jpls" ];

  meta = with lib; {
    description = "JPEG-LS plugin for the Python Pillow library";
    homepage = "https://github.com/planetmarshall/pillow-jpls";
    changelog = "https://github.com/planetmarshall/pillow-jpls/releases/tag/v${version}";
    license = licenses.bsd3;
    maintainers = with maintainers; [ bcdarwin ];
  };
}