2018-10-26 17:14:35 +02:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
2019-05-02 23:18:12 +02:00
|
|
|
, python
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cython ? null
|
|
|
|
, numpy ? null
|
2018-10-26 17:14:35 +02:00
|
|
|
}:
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
buildPythonPackage {
|
2018-10-26 17:14:35 +02:00
|
|
|
pname = "purepng";
|
|
|
|
version = "0.2.0";
|
|
|
|
|
2019-05-02 23:18:12 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Scondo";
|
|
|
|
repo = "purepng";
|
|
|
|
rev = "449aa00e97a8d7b8a200eb9048056d4da600a345";
|
|
|
|
sha256 = "105p7sxn2f21icfnqpah69mnd74r31szj330swbpz53k7gr6nlsv";
|
2018-10-26 17:14:35 +02:00
|
|
|
};
|
|
|
|
|
2019-05-02 23:18:12 +02:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-py37-stopiteration-in-generators.patch";
|
|
|
|
url = "https://github.com/Scondo/purepng/pull/28/commits/62d71dfc2be9ffdc4b3e5f642af0281a8ce8f946.patch";
|
|
|
|
sha256 = "1ag0pji3p012hmj8kadcd0vydv9702188c0isizsi964qcl4va6m";
|
|
|
|
})
|
|
|
|
];
|
2019-10-27 14:03:25 +01:00
|
|
|
patchFlags = [ "-p1" "-d" "code" ];
|
2019-05-02 23:18:12 +02:00
|
|
|
|
|
|
|
# cython is optional - if not supplied, the "pure python" implementation will be used
|
|
|
|
nativeBuildInputs = [ cython ];
|
|
|
|
|
|
|
|
# numpy is optional - if not supplied, tests simply have less coverage
|
|
|
|
checkInputs = [ numpy ];
|
|
|
|
# checkPhase begins by deleting source dir to force test execution against installed version
|
|
|
|
checkPhase = ''
|
|
|
|
rm -r code/png
|
|
|
|
${python.interpreter} code/test_png.py
|
|
|
|
'';
|
|
|
|
|
2018-10-26 17:14:35 +02:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Pure Python library for PNG image encoding/decoding";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/scondo/purepng";
|
2018-10-26 17:14:35 +02:00
|
|
|
license = licenses.mit;
|
2019-05-02 23:20:06 +02:00
|
|
|
maintainers = with maintainers; [ ris ];
|
2018-10-26 17:14:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|