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