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