Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 buildPythonPackage, 3 fetchFromGitHub, 4 lib, 5 pytestCheckHook, 6 pythonOlder, 7 setuptools, 8 typing-extensions, 9 zstd-c, 10}: 11 12buildPythonPackage rec { 13 pname = "pyzstd"; 14 version = "0.18.0"; 15 pyproject = true; 16 17 src = fetchFromGitHub { 18 owner = "Rogdham"; 19 repo = "pyzstd"; 20 tag = version; 21 hash = "sha256-15+GqJ/AMYs1R9ywo+muNVVbPkkzTMj//Zn/PPI+MCI="; 22 }; 23 24 postPatch = '' 25 # pyzst specifies setuptools<74 because 74+ drops `distutils.msvc9compiler`, 26 # required for Python 3.9 under Windows 27 substituteInPlace pyproject.toml \ 28 --replace-fail '"setuptools>=64,<74"' '"setuptools"' 29 30 # pyzst needs a copy of upstream zstd's license 31 ln -s ${zstd-c.src}/LICENSE zstd 32 ''; 33 34 nativeBuildInputs = [ 35 setuptools 36 ]; 37 38 build-system = [ 39 setuptools 40 ]; 41 42 dependencies = lib.optionals (pythonOlder "3.13") [ 43 typing-extensions 44 ]; 45 46 pythonRelaxDeps = [ 47 "typing-extensions" 48 ]; 49 50 buildInputs = [ 51 zstd-c 52 ]; 53 54 pypaBuildFlags = [ 55 "--config-setting=--global-option=--dynamic-link-zstd" 56 ]; 57 58 nativeCheckInputs = [ 59 pytestCheckHook 60 ]; 61 62 pythonImportsCheck = [ 63 "pyzstd" 64 ]; 65 66 meta = { 67 description = "Python bindings to Zstandard (zstd) compression library"; 68 homepage = "https://pyzstd.readthedocs.io"; 69 changelog = "https://github.com/Rogdham/pyzstd/blob/${version}/CHANGELOG.md"; 70 license = lib.licenses.bsd3; 71 maintainers = with lib.maintainers; [ 72 MattSturgeon 73 pitkling 74 PopeRigby 75 ]; 76 }; 77}