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";
|
2022-01-22 01:22:15 +00:00
|
|
|
version = "1.6.5";
|
2021-12-06 16:07:01 +00:00
|
|
|
format = "setuptools";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
pname = "PyTurboJPEG";
|
|
|
|
inherit version;
|
2022-01-22 01:22:15 +00:00
|
|
|
hash = "sha256-l3eeD/WGiqVQ2E92WBV8eTRPVdtUnP7wP4brE8PPTkw=";
|
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 ];
|
|
|
|
};
|
|
|
|
}
|