python3Packages.wasmer: switch to buildPythonPackage + cargo hooks

This commit is contained in:
Daniël de Kok 2021-02-11 19:30:30 +01:00
parent a24453fe94
commit 73bf3bdd89

View File

@ -1,63 +1,34 @@
{ lib { lib
, rustPlatform , rustPlatform
, fetchFromGitHub , fetchFromGitHub
, maturin
, buildPythonPackage , buildPythonPackage
, isPy38
, python
}: }:
let let
pname = "wasmer"; pname = "wasmer";
version = "1.0.0"; version = "1.0.0";
in buildPythonPackage rec {
wheel = rustPlatform.buildRustPackage rec {
inherit pname version;
src = fetchFromGitHub {
owner = "wasmerio";
repo = "wasmer-python";
rev = version;
hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
};
cargoHash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";
nativeBuildInputs = [ maturin python ];
preBuild = ''
cd packages/api
'';
buildPhase = ''
runHook preBuild
maturin build --release --manylinux off --strip
runHook postBuild
'';
postBuild = ''
cd ../..
'';
doCheck = false;
installPhase = ''
runHook preInstall
install -Dm644 -t $out target/wheels/*.whl
runHook postInstall
'';
};
in
buildPythonPackage rec {
inherit pname version; inherit pname version;
format = "wheel"; src = fetchFromGitHub {
src = wheel; owner = "wasmerio";
repo = "wasmer-python";
rev = version;
hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
};
unpackPhase = '' cargoDeps = rustPlatform.fetchCargoTarball {
mkdir -p dist inherit src;
cp $src/*.whl dist name = "${pname}-${version}";
''; hash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";
};
format = "pyproject";
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
buildAndTestSubdir = "packages/api";
doCheck = false;
pythonImportsCheck = [ "wasmer" ]; pythonImportsCheck = [ "wasmer" ];