about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix b/nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix
new file mode 100644
index 000000000000..1eebc05d89e3
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pyturbojpeg/default.nix
@@ -0,0 +1,45 @@
+{ lib
+, stdenv
+, python
+, buildPythonPackage
+, fetchPypi
+, substituteAll
+, libjpeg_turbo
+, numpy
+}:
+
+buildPythonPackage rec {
+  pname = "pyturbojpeg";
+  version = "1.4.1";
+
+  src = fetchPypi {
+    pname = "PyTurboJPEG";
+    inherit version;
+    sha256 = "09688a93331281e566569b4d313e1d1a058ca32ccae1a2473847a10e4ca2f2a7";
+  };
+
+  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 ];
+  };
+}