2021-04-05 15:23:46 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, libjpeg_turbo
|
|
|
|
, numpy
|
2021-12-06 16:07:01 +00:00
|
|
|
, python
|
|
|
|
, substituteAll
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyturbojpeg";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.6.3";
|
|
|
|
format = "setuptools";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
pname = "PyTurboJPEG";
|
|
|
|
inherit version;
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-5g9MQB7vpeuorVGExt0scHtLdrWlkuLOZMT38FhAsi4=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./lib-path.patch;
|
|
|
|
libturbojpeg = "${libjpeg_turbo.out}/lib/libturbojpeg${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
|
|
|
# upstream has no tests, but we want to test whether the library is found
|
|
|
|
checkPhase = ''
|
|
|
|
${python.interpreter} -c 'from turbojpeg import TurboJPEG; TurboJPEG()'
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"turbojpeg"
|
|
|
|
];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A Python wrapper of libjpeg-turbo for decoding and encoding JPEG image";
|
|
|
|
homepage = "https://github.com/lilohuang/PyTurboJPEG";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|