1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 cargo, 6 rustc, 7 rustPlatform, 8 setuptools, 9 setuptools-rust, 10 python, 11}: 12 13buildPythonPackage rec { 14 pname = "fastbencode"; 15 version = "0.3.6"; 16 pyproject = true; 17 18 src = fetchFromGitHub { 19 owner = "breezy-team"; 20 repo = "fastbencode"; 21 tag = "v${version}"; 22 hash = "sha256-Vn9NcJQaSF+k2TyRTAA9yMWiV+kYrfw6RIbIe99CCsg="; 23 }; 24 25 cargoDeps = rustPlatform.fetchCargoVendor { 26 inherit pname version src; 27 hash = "sha256-r229xfSrkbDEfm/nGFuQshyP4o04US0xJiRK4oXtaYE="; 28 }; 29 30 nativeBuildInputs = [ 31 cargo 32 rustPlatform.cargoSetupHook 33 rustc 34 ]; 35 36 build-system = [ 37 setuptools 38 setuptools-rust 39 ]; 40 41 pythonImportsCheck = [ "fastbencode" ]; 42 43 checkPhase = '' 44 runHook preCheck 45 ${python.interpreter} -m unittest tests.test_suite 46 runHook postCheck 47 ''; 48 49 meta = with lib; { 50 description = "Fast implementation of bencode"; 51 homepage = "https://github.com/breezy-team/fastbencode"; 52 changelog = "https://github.com/breezy-team/fastbencode/releases/tag/v${version}"; 53 license = licenses.gpl2Plus; 54 maintainers = [ ]; 55 }; 56}