python3Packages.johnnycanencrypt: switch to buildPythonPackage + cargo hooks

This commit is contained in:
Daniël de Kok 2021-02-11 19:36:43 +01:00
parent 15c32ae8b1
commit 17bc423534

View file

@ -1,14 +1,13 @@
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, pipInstallHook
, buildPythonPackage
, rustPlatform
, llvmPackages
, pkg-config
, maturin
, pcsclite
, nettle
, python
, requests
, vcrpy
, numpy
@ -17,7 +16,7 @@
, PCSC
}:
rustPlatform.buildRustPackage rec {
buildPythonPackage rec {
pname = "johnnycanencrypt";
version = "0.5.0";
disabled = pythonOlder "3.7";
@ -28,7 +27,16 @@ rustPlatform.buildRustPackage rec {
rev = "v${version}";
sha256 = "192wfrlyylrpzq70yki421mi1smk8q2cyki2a1d03q7h6apib3j4";
};
cargoPatches = [ ./Cargo.lock.patch ];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit patches src;
name = "${pname}-${version}";
hash = "sha256-2XhXCKyXVlFgbcOoMy/A5ajiIVxBii56YeI29mO720U=";
};
format = "pyproject";
patches = [ ./Cargo.lock.patch ];
cargoSha256 = "0ifvpdizcdp2c5x2x2j1bhhy5a75q0pk7a63dmh52mlpmh45fy6r";
@ -42,10 +50,10 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
llvmPackages.clang
pkg-config
python
maturin
pipInstallHook
];
] ++ (with rustPlatform; [
cargoSetupHook
maturinBuildHook
]);
buildInputs = [
pcsclite
@ -67,17 +75,6 @@ rustPlatform.buildRustPackage rec {
sed '/project-url = /d' -i Cargo.toml
'';
buildPhase = ''
runHook preBuild
maturin build --release --manylinux off --strip --cargo-extra-args="-j $NIX_BUILD_CORES --frozen"
runHook postBuild
'';
installPhase = ''
install -Dm644 -t dist target/wheels/*.whl
pipInstallPhase
'';
preCheck = ''
export TESTDIR=$(mktemp -d)
cp -r tests/ $TESTDIR