1{ lib 2, stdenv 3, fetchFromGitHub 4, buildPythonPackage 5, rustPlatform 6, llvmPackages 7, pkg-config 8, pcsclite 9, nettle 10, requests 11, vcrpy 12, numpy 13, pytestCheckHook 14, pythonOlder 15, PCSC 16, libiconv 17}: 18 19buildPythonPackage rec { 20 pname = "johnnycanencrypt"; 21 version = "0.5.0"; 22 disabled = pythonOlder "3.7"; 23 24 src = fetchFromGitHub { 25 owner = "kushaldas"; 26 repo = "johnnycanencrypt"; 27 rev = "v${version}"; 28 sha256 = "192wfrlyylrpzq70yki421mi1smk8q2cyki2a1d03q7h6apib3j4"; 29 }; 30 31 cargoDeps = rustPlatform.fetchCargoTarball { 32 inherit patches src; 33 name = "${pname}-${version}"; 34 hash = "sha256-2XhXCKyXVlFgbcOoMy/A5ajiIVxBii56YeI29mO720U="; 35 }; 36 37 format = "pyproject"; 38 39 patches = [ ./Cargo.lock.patch ]; 40 41 LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; 42 43 propagatedBuildInputs = [ 44 requests 45 vcrpy 46 ]; 47 48 nativeBuildInputs = [ 49 llvmPackages.clang 50 pkg-config 51 ] ++ (with rustPlatform; [ 52 cargoSetupHook 53 maturinBuildHook 54 ]); 55 56 buildInputs = [ 57 pcsclite 58 nettle 59 ] ++ lib.optionals stdenv.isDarwin [ 60 PCSC 61 libiconv 62 ]; 63 64 # Needed b/c need to check AFTER python wheel is installed (using Rust Build, not buildPythonPackage) 65 doCheck = false; 66 doInstallCheck = true; 67 68 installCheckInputs = [ 69 pytestCheckHook 70 numpy 71 ]; 72 73 # Remove with the next release after 0.5.0. This change is required 74 # for compatibility with maturin 0.9.0. 75 postPatch = '' 76 sed '/project-url = /d' -i Cargo.toml 77 substituteInPlace pyproject.toml \ 78 --replace 'manylinux = "off"' 'skip-auditwheel = true' 79 ''; 80 81 preCheck = '' 82 export TESTDIR=$(mktemp -d) 83 cp -r tests/ $TESTDIR 84 pushd $TESTDIR 85 ''; 86 87 postCheck = '' 88 popd 89 ''; 90 91 pythonImportsCheck = [ "johnnycanencrypt" ]; 92 93 meta = with lib; { 94 homepage = "https://github.com/kushaldas/johnnycanencrypt"; 95 description = "Python module for OpenPGP written in Rust"; 96 license = licenses.gpl3Plus; 97 maintainers = with maintainers; [ _0x4A6F ]; 98 }; 99}