summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-jose/default.nix
blob: 0aafd036dc5a9f0a570125f26354d16f4d53b868 (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
61
62
63
64
65
66
67
68
{
  lib,
  buildPythonPackage,
  cryptography,
  fetchFromGitHub,
  fetchpatch,
  pycrypto,
  pycryptodome,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "python-jose";
  version = "3.5.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mpdavis";
    repo = "python-jose";
    tag = version;
    hash = "sha256-8DQ0RBQ4ZgEIwcosgX3dzr928cYIQoH0obIOgk0+Ozs=";
  };

  patches = [
    # https://github.com/mpdavis/python-jose/pull/393
    (fetchpatch {
      name = "fix-test_incorrect_public_key_hmac_signing.patch";
      url = "https://github.com/mpdavis/python-jose/commit/7c0e4c6640bdc9cd60ac66d96d5d90f4377873db.patch";
      hash = "sha256-bCzxZEWKYD20TLqzVv6neZlpU41otbVqaXc7C0Ky9BQ=";
    })
  ];

  pythonRemoveDeps = [
    # These aren't needed if the cryptography backend is used:
    # https://github.com/mpdavis/python-jose/blob/3.5.0/README.rst#cryptographic-backends
    "ecdsa"
    "pyasn1"
    "rsa"
  ];

  build-system = [ setuptools ];

  dependencies = [
    cryptography
  ];

  optional-dependencies = {
    cryptography = [ cryptography ];
    pycrypto = [ pycrypto ];
    pycryptodome = [ pycryptodome ];
  };

  nativeCheckInputs = [
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "jose" ];

  meta = {
    description = "JOSE implementation in Python";
    homepage = "https://github.com/mpdavis/python-jose";
    changelog = "https://github.com/mpdavis/python-jose/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}