1{ lib
2, fetchFromGitHub
3, fetchpatch
4, buildPythonPackage
5, pythonOlder
6, pytestCheckHook
7, rustPlatform
8, stdenv
9, py-bip39-bindings
10, libiconv }:
11
12buildPythonPackage rec {
13 pname = "py-sr25519-bindings";
14 version = "0.1.5";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.6";
18
19 src = fetchFromGitHub {
20 owner = "polkascan";
21 repo = "py-sr25519-bindings";
22 rev = "a97398b386c10ebe0a1f6c45dea466add0d407ce";
23 sha256 = "sha256-RJfwWeD82J5QqY+qq2bC3vlqT75jUwhTXuIsza4qUzk=";
24 };
25
26 cargoDeps = rustPlatform.importCargoLock {
27 lockFile = ./Cargo.lock;
28 };
29
30 postPatch = ''
31 cp ${./Cargo.lock} Cargo.lock
32 '';
33
34 nativeBuildInputs = with rustPlatform; [
35 cargoSetupHook
36 maturinBuildHook
37 ];
38
39 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
40
41 checkInputs = [
42 pytestCheckHook
43 py-bip39-bindings
44 ];
45
46 pytestFlagsArray = [
47 "tests.py"
48 ];
49
50 pythonImportsCheck = [
51 "sr25519"
52 ];
53
54 meta = with lib; {
55 description = "Python bindings for sr25519 library";
56 homepage = "https://github.com/polkascan/py-sr25519-bindings";
57 license = licenses.asl20;
58 maintainers = with maintainers; [ onny stargate01 ];
59 };
60}