summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pgpy/default.nix
blob: 434ef941eaf06354a6e256fd592d08f539c73b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  setuptools,
  pyasn1,
  cryptography,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pgpy";
  version = "0.6.0";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "SecurityInnovation";
    repo = "PGPy";
    rev = "v${version}";
    hash = "sha256-47YiHNxmjyCOYHHUV3Zyhs3Att9HZtCXYfbN34ooTxU=";
  };

  build-system = [ setuptools ];

  dependencies = [
    pyasn1
    cryptography
  ];

  patches = [
    # https://github.com/SecurityInnovation/PGPy/issues/462
    ./pr-443.patch

    # https://github.com/SecurityInnovation/PGPy/pull/474
    ./Fix-compat-with-current-cryptography.patch
  ];

  postPatch = ''
    # https://github.com/SecurityInnovation/PGPy/issues/472
    substituteInPlace tests/test_10_exceptions.py \
      --replace-fail ", 512" ", 1024" # We need longer test key because pgp deprecated length=512
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    homepage = "https://github.com/SecurityInnovation/PGPy";
    description = "Pretty Good Privacy for Python";
    longDescription = ''
      PGPy is a Python library for implementing Pretty Good Privacy into Python
      programs, conforming to the OpenPGP specification per RFC 4880.
    '';
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      eadwu
      dotlambda
    ];
  };
}