1{
2 lib,
3 pythonOlder,
4 fetchFromGitHub,
5 buildPythonPackage,
6 setuptools,
7 pyasn1,
8 cryptography,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "pgpy";
14 version = "0.6.0";
15
16 disabled = pythonOlder "3.6";
17
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "SecurityInnovation";
22 repo = "PGPy";
23 rev = "v${version}";
24 hash = "sha256-47YiHNxmjyCOYHHUV3Zyhs3Att9HZtCXYfbN34ooTxU=";
25 };
26
27 build-system = [ setuptools ];
28
29 dependencies = [
30 pyasn1
31 cryptography
32 ];
33
34 patches = [
35 # https://github.com/SecurityInnovation/PGPy/issues/462
36 ./pr-443.patch
37
38 # https://github.com/SecurityInnovation/PGPy/pull/474
39 ./Fix-compat-with-current-cryptography.patch
40 ];
41
42 postPatch = ''
43 # https://github.com/SecurityInnovation/PGPy/issues/472
44 substituteInPlace tests/test_10_exceptions.py \
45 --replace-fail ", 512" ", 1024" # We need longer test key because pgp deprecated length=512
46 '';
47
48 nativeCheckInputs = [ pytestCheckHook ];
49
50 meta = {
51 homepage = "https://github.com/SecurityInnovation/PGPy";
52 description = "Pretty Good Privacy for Python";
53 longDescription = ''
54 PGPy is a Python library for implementing Pretty Good Privacy into Python
55 programs, conforming to the OpenPGP specification per RFC 4880.
56 '';
57 license = lib.licenses.bsd3;
58 maintainers = with lib.maintainers; [
59 eadwu
60 dotlambda
61 ];
62 };
63}