nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 isPyPy,
6 cffi,
7 setuptools,
8 hypothesis,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "zstandard";
14 version = "0.25.0";
15 pyproject = true;
16
17 src = fetchPypi {
18 inherit pname version;
19 hash = "sha256-dxPhF50WLPXHkG2oduwsy5w6ncvf/vDMf3DDZnogXws=";
20 };
21
22 postPatch = ''
23 substituteInPlace pyproject.toml \
24 --replace-fail "cffi~=" "cffi>=" \
25 '';
26
27 build-system = [
28 cffi
29 setuptools
30 ];
31
32 dependencies = lib.optionals isPyPy [ cffi ];
33
34 # python-zstandard depends on unstable zstd C APIs and may break with version mismatches,
35 # so we don't provide system zstd for this package
36 # https://github.com/indygreg/python-zstandard/blob/9eb56949b1764a166845e065542690942a3203d3/c-ext/backend_c.c#L137-L150
37
38 nativeCheckInputs = [
39 hypothesis
40 pytestCheckHook
41 ];
42
43 preCheck = ''
44 rm -r zstandard
45 '';
46
47 pythonImportsCheck = [ "zstandard" ];
48
49 meta = {
50 description = "Zstandard bindings for Python";
51 homepage = "https://github.com/indygreg/python-zstandard";
52 license = lib.licenses.bsdOriginal;
53 maintainers = with lib.maintainers; [ arnoldfarkas ];
54 };
55}