1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 substituteAll,
8 bcrypt,
9 pyopenssl,
10 python-gnupg,
11 pytestCheckHook,
12 requests,
13 openssl,
14}:
15
16buildPythonPackage rec {
17 pname = "proton-client";
18 version = "0.7.1";
19 format = "setuptools";
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "ProtonMail";
24 repo = "proton-python-client";
25 rev = version;
26 hash = "sha256-mhPq9O/LCu3+E1jKlaJmrI8dxbA9BIwlc34qGwoxi5g=";
27 };
28
29 propagatedBuildInputs = [
30 bcrypt
31 pyopenssl
32 python-gnupg
33 requests
34 ];
35
36 buildInputs = [ openssl ];
37
38 patches = [
39 # Patches library by fixing the openssl path
40 (substituteAll {
41 src = ./0001-OpenSSL-path-fix.patch;
42 openssl = openssl.out;
43 ext = stdenv.hostPlatform.extensions.sharedLibrary;
44 })
45 ];
46
47 nativeCheckInputs = [ pytestCheckHook ];
48
49 disabledTests = [
50 #ValueError: Invalid modulus
51 "test_modulus_verification"
52 ];
53
54 pythonImportsCheck = [ "proton" ];
55
56 meta = with lib; {
57 description = "Python Proton client module";
58 homepage = "https://github.com/ProtonMail/proton-python-client";
59 license = licenses.gpl3Only;
60 maintainers = with maintainers; [ wolfangaukang ];
61 platforms = platforms.linux;
62 };
63}