1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchPypi, 6 libjpeg_turbo, 7 setuptools, 8 numpy, 9 python, 10 substituteAll, 11}: 12 13buildPythonPackage rec { 14 pname = "pyturbojpeg"; 15 version = "1.7.3"; 16 pyproject = true; 17 18 src = fetchPypi { 19 pname = "PyTurboJPEG"; 20 inherit version; 21 hash = "sha256-edSOOrU0YVKP+4AJxCCYnQh6iewxVFTM1QmU88mukis="; 22 }; 23 24 patches = [ 25 (substituteAll { 26 src = ./lib-path.patch; 27 libturbojpeg = "${libjpeg_turbo.out}/lib/libturbojpeg${stdenv.hostPlatform.extensions.sharedLibrary}"; 28 }) 29 ]; 30 31 nativeBuildInputs = [ setuptools ]; 32 33 propagatedBuildInputs = [ numpy ]; 34 35 # upstream has no tests, but we want to test whether the library is found 36 checkPhase = '' 37 ${python.interpreter} -c 'from turbojpeg import TurboJPEG; TurboJPEG()' 38 ''; 39 40 pythonImportsCheck = [ "turbojpeg" ]; 41 42 meta = with lib; { 43 description = "A Python wrapper of libjpeg-turbo for decoding and encoding JPEG image"; 44 homepage = "https://github.com/lilohuang/PyTurboJPEG"; 45 license = licenses.mit; 46 maintainers = with maintainers; [ dotlambda ]; 47 }; 48}