summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pypng/default.nix
blob: d618e3266bde99d64b9a670e9509615e8b304295 (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,
  fetchFromGitLab,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pypng";
  version = "0.20231004.0";
  pyproject = true;

  src = fetchFromGitLab {
    owner = "drj11";
    repo = "pypng";
    tag = "pypng-${version}";
    hash = "sha256-xNUI3yGfwmaccCxgljIZzgJ6YgNxcuOzCXDE7RFJP2I=";
  };

  build-system = [ setuptools ];

  patches = [
    # pngsuite is imported by code/test_png.py but is not defined in
    # setup.cfg, so it isn't built - this adds it to py_modules
    ./setup-cfg-pngsuite.patch
  ];

  # allow tests to use the binaries produced by this package
  preCheck = ''
    export PATH="$out/bin:$PATH"
  '';

  pythonImportsCheck = [
    "png"
    "pngsuite"
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    description = "Pure Python library for PNG image encoding/decoding";
    homepage = "https://gitlab.com/drj11/pypng";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ prusnak ];
  };
}