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