about summary refs log tree commit diff
path: root/pkgs/development/python-modules/lz4/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/lz4/default.nix')
-rw-r--r--pkgs/development/python-modules/lz4/default.nix69
1 files changed, 48 insertions, 21 deletions
diff --git a/pkgs/development/python-modules/lz4/default.nix b/pkgs/development/python-modules/lz4/default.nix
index cc84fa75c6997..9e2cc9b31e155 100644
--- a/pkgs/development/python-modules/lz4/default.nix
+++ b/pkgs/development/python-modules/lz4/default.nix
@@ -1,41 +1,68 @@
 { lib
 , buildPythonPackage
 , fetchFromGitHub
-, future
-, isPy3k
+, pythonOlder
+
+# native inputs
 , pkgconfig
-, psutil
-, pytest
-, pytest-cov
-, pytest-runner
 , setuptools-scm
+
+# tests
+, psutil
+, pytestCheckHook
 }:
 
 buildPythonPackage rec {
   pname = "python-lz4";
-  version = "3.1.10";
+  version = "3.1.12";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.5";
 
-  # get full repository inorder to run tests
+  # get full repository in order to run tests
   src = fetchFromGitHub {
     owner = pname;
     repo = pname;
-    rev = version;
-    sha256 = "0a4gic8xh3simkk5k8302rxwf765pr6y63k3js79mkl983vpxcim";
+    rev = "v${version}";
+    sha256 = "sha256-fqt9aJGqZpfbiYtU8cmm7UQaixZwbTKFBwRfR1B/qic=";
   };
 
-  nativeBuildInputs = [ setuptools-scm pkgconfig pytest-runner ];
-  checkInputs = [ pytest pytest-cov psutil ];
-  propagatedBuildInputs = lib.optionals (!isPy3k) [ future ];
+  SETUPTOOLS_SCM_PRETEND_VERSION = version;
+
+  postPatch = ''
+    sed -i '/pytest-cov/d' setup.py
+  '';
+
+  nativeBuildInputs = [
+    setuptools-scm
+    pkgconfig
+  ];
+
+  pythonImportsCheck = [
+    "lz4"
+    "lz4.block"
+    "lz4.frame"
+    "lz4.stream"
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+    psutil
+  ];
+
+  # leave build directory, so the installed library gets imported
+  preCheck = ''
+    pushd tests
+  '';
 
-  # give a hint to setuptools-scm on package version
-  preBuild = ''
-    export SETUPTOOLS_SCM_PRETEND_VERSION="v${version}"
+  postCheck = ''
+    popd
   '';
 
-  meta = {
-     description = "LZ4 Bindings for Python";
-     homepage = "https://github.com/python-lz4/python-lz4";
-     license = lib.licenses.bsd3;
-     maintainers = with lib.maintainers; [ costrouc ];
+  meta = with lib; {
+    description = "LZ4 Bindings for Python";
+    homepage = "https://github.com/python-lz4/python-lz4";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ costrouc ];
   };
 }