1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitLab,
5 pytestCheckHook,
6 setuptools,
7}:
8
9buildPythonPackage rec {
10 pname = "pypng";
11 version = "0.20231004.0";
12 pyproject = true;
13
14 src = fetchFromGitLab {
15 owner = "drj11";
16 repo = "pypng";
17 tag = "pypng-${version}";
18 hash = "sha256-tTnsGCAmHexDWm/T5xpHpcBaQcBEqMfTFaoOAeC+pDs=";
19 };
20
21 build-system = [ setuptools ];
22
23 patches = [
24 # pngsuite is imported by code/test_png.py but is not defined in
25 # setup.cfg, so it isn't built - this adds it to py_modules
26 ./setup-cfg-pngsuite.patch
27 ];
28
29 # allow tests to use the binaries produced by this package
30 preCheck = ''
31 export PATH="$out/bin:$PATH"
32 '';
33
34 pythonImportsCheck = [
35 "png"
36 "pngsuite"
37 ];
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 meta = with lib; {
42 description = "Pure Python library for PNG image encoding/decoding";
43 homepage = "https://gitlab.com/drj11/pypng";
44 license = licenses.mit;
45 maintainers = with maintainers; [ prusnak ];
46 };
47}