ce641f4048
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
48 lines
1 KiB
Nix
48 lines
1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, fetchPypi
|
|
, libjpeg_turbo
|
|
, numpy
|
|
, python
|
|
, substituteAll
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "pyturbojpeg";
|
|
version = "1.6.3";
|
|
format = "setuptools";
|
|
|
|
src = fetchPypi {
|
|
pname = "PyTurboJPEG";
|
|
inherit version;
|
|
sha256 = "sha256-5g9MQB7vpeuorVGExt0scHtLdrWlkuLOZMT38FhAsi4=";
|
|
};
|
|
|
|
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()'
|
|
'';
|
|
|
|
pythonImportsCheck = [
|
|
"turbojpeg"
|
|
];
|
|
|
|
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 ];
|
|
};
|
|
}
|