python3Packages.johnnycanencrypt: switch to buildPythonPackage + cargo hooks
This commit is contained in:
parent
15c32ae8b1
commit
17bc423534
|
@ -1,14 +1,13 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, rustPlatform
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, pipInstallHook
|
, buildPythonPackage
|
||||||
|
, rustPlatform
|
||||||
, llvmPackages
|
, llvmPackages
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, maturin
|
, maturin
|
||||||
, pcsclite
|
, pcsclite
|
||||||
, nettle
|
, nettle
|
||||||
, python
|
|
||||||
, requests
|
, requests
|
||||||
, vcrpy
|
, vcrpy
|
||||||
, numpy
|
, numpy
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
, PCSC
|
, PCSC
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "johnnycanencrypt";
|
pname = "johnnycanencrypt";
|
||||||
version = "0.5.0";
|
version = "0.5.0";
|
||||||
disabled = pythonOlder "3.7";
|
disabled = pythonOlder "3.7";
|
||||||
|
@ -28,7 +27,16 @@ rustPlatform.buildRustPackage rec {
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "192wfrlyylrpzq70yki421mi1smk8q2cyki2a1d03q7h6apib3j4";
|
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";
|
cargoSha256 = "0ifvpdizcdp2c5x2x2j1bhhy5a75q0pk7a63dmh52mlpmh45fy6r";
|
||||||
|
|
||||||
|
@ -42,10 +50,10 @@ rustPlatform.buildRustPackage rec {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
llvmPackages.clang
|
llvmPackages.clang
|
||||||
pkg-config
|
pkg-config
|
||||||
python
|
] ++ (with rustPlatform; [
|
||||||
maturin
|
cargoSetupHook
|
||||||
pipInstallHook
|
maturinBuildHook
|
||||||
];
|
]);
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pcsclite
|
pcsclite
|
||||||
|
@ -67,17 +75,6 @@ rustPlatform.buildRustPackage rec {
|
||||||
sed '/project-url = /d' -i Cargo.toml
|
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 = ''
|
preCheck = ''
|
||||||
export TESTDIR=$(mktemp -d)
|
export TESTDIR=$(mktemp -d)
|
||||||
cp -r tests/ $TESTDIR
|
cp -r tests/ $TESTDIR
|
||||||
|
|
Loading…
Reference in a new issue