mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-17 03:03:37 +00:00
python3Packages.wasmer*: package entire wasmer-compiler family
This commit is contained in:
parent
5252fe5f7f
commit
987296a1e1
@ -1,45 +1,99 @@
|
|||||||
{ lib
|
{ stdenv
|
||||||
, stdenv
|
, lib
|
||||||
, rustPlatform
|
, rustPlatform
|
||||||
|
, callPackage
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, libiconv
|
, libiconv
|
||||||
|
, llvm_11
|
||||||
|
, libffi
|
||||||
|
, libxml2
|
||||||
|
, ncurses
|
||||||
|
, zlib
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
let
|
||||||
pname = "wasmer";
|
common =
|
||||||
version = "1.0.0";
|
{ pname
|
||||||
|
, buildAndTestSubdir
|
||||||
|
, cargoHash
|
||||||
|
, extraNativeBuildInputs ? [ ]
|
||||||
|
, extraBuildInputs ? [ ]
|
||||||
|
}: buildPythonPackage rec {
|
||||||
|
inherit pname;
|
||||||
|
version = "1.0.0";
|
||||||
|
format = "pyproject";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
outputs = [ "out" ] ++ lib.optional (pname == "wasmer") "testsout";
|
||||||
owner = "wasmerio";
|
|
||||||
repo = "wasmer-python";
|
src = fetchFromGitHub {
|
||||||
rev = version;
|
owner = "wasmerio";
|
||||||
hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
|
repo = "wasmer-python";
|
||||||
|
rev = version;
|
||||||
|
hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||||
|
inherit src;
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
sha256 = cargoHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = (with rustPlatform; [ cargoSetupHook maturinBuildHook ])
|
||||||
|
++ extraNativeBuildInputs;
|
||||||
|
|
||||||
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]
|
||||||
|
++ extraBuildInputs;
|
||||||
|
|
||||||
|
inherit buildAndTestSubdir;
|
||||||
|
|
||||||
|
postInstall = lib.optionalString (pname == "wasmer") ''
|
||||||
|
mkdir $testsout
|
||||||
|
cp -R tests $testsout/tests
|
||||||
|
'';
|
||||||
|
|
||||||
|
# check in passthru.tests.pytest because all packages are required to run the tests
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
passthru.tests = lib.optionalAttrs (pname == "wasmer") {
|
||||||
|
pytest = callPackage ./tests.nix { };
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "${lib.replaceStrings ["-"] ["_"] pname}" ];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Python extension to run WebAssembly binaries";
|
||||||
|
homepage = "https://github.com/wasmerio/wasmer-python";
|
||||||
|
license = licenses.mit;
|
||||||
|
platforms = platforms.unix;
|
||||||
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
wasmer = common {
|
||||||
|
pname = "wasmer";
|
||||||
|
buildAndTestSubdir = "packages/api";
|
||||||
|
cargoHash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
cargoDeps = rustPlatform.fetchCargoTarball {
|
wasmer-compiler-cranelift = common {
|
||||||
inherit src;
|
pname = "wasmer-compiler-cranelift";
|
||||||
name = "${pname}-${version}";
|
buildAndTestSubdir = "packages/compiler-cranelift";
|
||||||
hash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";
|
cargoHash = "sha256-cHgAUwqnbQV3E5nUYGYQ48ntbIFfq4JXfU5IrSFZ3zI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
format = "pyproject";
|
wasmer-compiler-llvm = common {
|
||||||
|
pname = "wasmer-compiler-llvm";
|
||||||
|
buildAndTestSubdir = "packages/compiler-llvm";
|
||||||
|
cargoHash = "sha256-Jm22CC5S3pN/vdVvsGZdvtoAgPzWVLto8wavSJdxY3A=";
|
||||||
|
extraNativeBuildInputs = [ llvm_11 ];
|
||||||
|
extraBuildInputs = [ libffi libxml2.out ncurses zlib ];
|
||||||
|
};
|
||||||
|
|
||||||
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
|
wasmer-compiler-singlepass = common {
|
||||||
|
pname = "wasmer-compiler-singlepass";
|
||||||
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
buildAndTestSubdir = "packages/compiler-singlepass";
|
||||||
|
cargoHash = "sha256-lmqEo3+jYoN+4EEYphcoE4b84jdFcvYVycjrJ956Bh8=";
|
||||||
buildAndTestSubdir = "packages/api";
|
|
||||||
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
pythonImportsCheck = [ "wasmer" ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Python extension to run WebAssembly binaries";
|
|
||||||
homepage = "https://github.com/wasmerio/wasmer-python";
|
|
||||||
license = licenses.mit;
|
|
||||||
platforms = platforms.unix;
|
|
||||||
maintainers = with maintainers; [ SuperSandro2000 ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
25
pkgs/development/python-modules/wasmer/tests.nix
Normal file
25
pkgs/development/python-modules/wasmer/tests.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ buildPythonPackage
|
||||||
|
, wasmer
|
||||||
|
, pytestCheckHook
|
||||||
|
, wasmer-compiler-cranelift
|
||||||
|
, wasmer-compiler-llvm
|
||||||
|
, wasmer-compiler-singlepass
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildPythonPackage rec {
|
||||||
|
pname = "wasmer-tests";
|
||||||
|
inherit (wasmer) version;
|
||||||
|
|
||||||
|
src = wasmer.testsout;
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
dontInstall = true;
|
||||||
|
|
||||||
|
checkInputs = [
|
||||||
|
pytestCheckHook
|
||||||
|
wasmer
|
||||||
|
wasmer-compiler-cranelift
|
||||||
|
wasmer-compiler-llvm
|
||||||
|
wasmer-compiler-singlepass
|
||||||
|
];
|
||||||
|
}
|
@ -9311,7 +9311,8 @@ in {
|
|||||||
|
|
||||||
wasm = callPackage ../development/python-modules/wasm { };
|
wasm = callPackage ../development/python-modules/wasm { };
|
||||||
|
|
||||||
wasmer = callPackage ../development/python-modules/wasmer { };
|
wasmerPackages = pkgs.recurseIntoAttrs (callPackage ../development/python-modules/wasmer { });
|
||||||
|
inherit (self.wasmerPackages) wasmer wasmer-compiler-cranelift wasmer-compiler-llvm wasmer-compiler-singlepass;
|
||||||
|
|
||||||
watchdog = callPackage ../development/python-modules/watchdog {
|
watchdog = callPackage ../development/python-modules/watchdog {
|
||||||
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;
|
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;
|
||||||
|
Loading…
Reference in New Issue
Block a user