1{ lib
2, pythonOlder
3, fetchFromGitHub
4, fetchpatch
5, buildPythonPackage
6, six
7, enum34
8, pyasn1
9, cryptography
10, pytestCheckHook
11}:
12
13buildPythonPackage rec {
14 pname = "pgpy";
15 version = "0.5.4";
16
17 src = fetchFromGitHub {
18 owner = "SecurityInnovation";
19 repo = "PGPy";
20 rev = "v${version}";
21 hash = "sha256-iuga6vZ7eOl/wNVuLnhDVeUPJPibGm8iiyTC4dOA7A4=";
22 };
23
24 patches = [
25 # Fixes the issue in https://github.com/SecurityInnovation/PGPy/issues/402.
26 # by pulling in https://github.com/SecurityInnovation/PGPy/pull/403.
27 (fetchpatch {
28 name = "crytography-38-support.patch";
29 url = "https://github.com/SecurityInnovation/PGPy/commit/d84597eb8417a482433ff51dc6b13060d4b2e686.patch";
30 hash = "sha256-dviXCSGtPguROHVZ1bt/eEfpATjehm8jZ5BeVjxdb8U=";
31 })
32 ];
33
34 propagatedBuildInputs = [
35 six
36 pyasn1
37 cryptography
38 ] ++ lib.optionals (pythonOlder "3.4") [
39 enum34
40 ];
41
42 checkInputs = [
43 pytestCheckHook
44 ];
45
46 disabledTests = [
47 # assertions contains extra: IDEA has been deprecated
48 "test_encrypt_bad_cipher"
49 ];
50
51 meta = with lib; {
52 homepage = "https://github.com/SecurityInnovation/PGPy";
53 description = "Pretty Good Privacy for Python 2 and 3";
54 longDescription = ''
55 PGPy is a Python (2 and 3) library for implementing Pretty Good Privacy
56 into Python programs, conforming to the OpenPGP specification per RFC
57 4880.
58 '';
59 license = licenses.bsd3;
60 maintainers = with maintainers; [ eadwu dotlambda ];
61 };
62}