about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pypng/default.nix
blob: eb06d04b5dbe736b90e0e09fab4206e59d394840 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitLab,
  pytestCheckHook,
  setuptools,
}:

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

  src = fetchFromGitLab {
    owner = "drj11";
    repo = "pypng";
    rev = "refs/tags/${pname}-${version}";
    hash = "sha256-tTnsGCAmHexDWm/T5xpHpcBaQcBEqMfTFaoOAeC+pDs=";
  };

  nativeBuildInputs = [ 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 = with lib; {
    description = "Pure Python library for PNG image encoding/decoding";
    homepage = "https://github.com/drj11/pypng";
    license = licenses.mit;
    maintainers = with maintainers; [ prusnak ];
  };
}