2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2022-01-26 04:04:25 +00:00
|
|
|
, pythonOlder
|
2022-04-15 01:41:22 +00:00
|
|
|
, python
|
2022-01-26 04:04:25 +00:00
|
|
|
|
|
|
|
# native inputs
|
2020-04-24 23:36:52 +00:00
|
|
|
, pkgconfig
|
2021-06-04 09:07:49 +00:00
|
|
|
, setuptools-scm
|
2022-01-26 04:04:25 +00:00
|
|
|
|
|
|
|
# tests
|
|
|
|
, psutil
|
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-lz4";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "4.0.1";
|
2022-01-26 04:04:25 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
# get full repository in order to run tests
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-hQuZkstsB37pFDWmA0W6qGd7rAer1mun7Z6MxMp0ZmE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
# for lz4.steam
|
|
|
|
PYLZ4_EXPERIMENTAL = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
# prevent local lz4 directory from getting imported as it lacks native extensions
|
|
|
|
preCheck = ''
|
|
|
|
rm -r lz4
|
|
|
|
export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "LZ4 Bindings for Python";
|
|
|
|
homepage = "https://github.com/python-lz4/python-lz4";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ costrouc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|