summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pilkit/default.nix
blob: 6897d126db6c80d65a35ea252f9be26b04db8a9d (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  mock,
  pillow,
  pytestCheckHook,
  pytest-cov-stub,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pilkit";
  version = "3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "matthewwithanm";
    repo = "pilkit";
    tag = version;
    hash = "sha256-NmD9PFCkz3lz4AnGoQUpkt35q0zvDVm+kx7lVDFBcHk=";
  };

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [ pillow ];

  nativeCheckInputs = [
    mock
    pytestCheckHook
    pytest-cov-stub
  ];

  postPatch = ''
    substituteInPlace pilkit/processors/resize.py \
      --replace "Image.ANTIALIAS" "Image.Resampling.LANCZOS"
  '';

  pythonImportsCheck = [ "pilkit" ];

  meta = {
    description = "Collection of utilities and processors for the Python Imaging Library";
    homepage = "https://github.com/matthewwithanm/pilkit/";
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}