2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchFromGitHub,
|
2024-06-05 15:53:02 +00:00
|
|
|
libjpeg_turbo,
|
|
|
|
setuptools,
|
|
|
|
numpy,
|
|
|
|
python,
|
|
|
|
substituteAll,
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyturbojpeg";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.7.7";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lilohuang";
|
|
|
|
repo = "PyTurboJPEG";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-JPjGZGVMZH6sDNRdV6kWsCpEjLT2aMrTy+bI4mRbdpw=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./lib-path.patch;
|
2024-09-19 14:19:46 +00:00
|
|
|
libturbojpeg = "${lib.getLib libjpeg_turbo}/lib/libturbojpeg${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2021-04-05 15:23:46 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [ setuptools ];
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [ numpy ];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
# upstream has no tests, but we want to test whether the library is found
|
|
|
|
checkPhase = ''
|
2024-09-19 14:19:46 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
${python.interpreter} -c 'from turbojpeg import TurboJPEG; TurboJPEG()'
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2021-04-05 15:23:46 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "turbojpeg" ];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-09-19 14:19:46 +00:00
|
|
|
changelog = "https://github.com/lilohuang/PyTurboJPEG/releases/tag/v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Python wrapper of libjpeg-turbo for decoding and encoding JPEG image";
|
2021-04-05 15:23:46 +00:00
|
|
|
homepage = "https://github.com/lilohuang/PyTurboJPEG";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|