Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildPythonPackage,
4 cryptography,
5 fetchFromGitHub,
6 fetchpatch,
7 pycrypto,
8 pycryptodome,
9 pytestCheckHook,
10 setuptools,
11}:
12
13buildPythonPackage rec {
14 pname = "python-jose";
15 version = "3.5.0";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "mpdavis";
20 repo = "python-jose";
21 tag = version;
22 hash = "sha256-8DQ0RBQ4ZgEIwcosgX3dzr928cYIQoH0obIOgk0+Ozs=";
23 };
24
25 patches = [
26 # https://github.com/mpdavis/python-jose/pull/393
27 (fetchpatch {
28 name = "fix-test_incorrect_public_key_hmac_signing.patch";
29 url = "https://github.com/mpdavis/python-jose/commit/7c0e4c6640bdc9cd60ac66d96d5d90f4377873db.patch";
30 hash = "sha256-bCzxZEWKYD20TLqzVv6neZlpU41otbVqaXc7C0Ky9BQ=";
31 })
32 ];
33
34 pythonRemoveDeps = [
35 # These aren't needed if the cryptography backend is used:
36 # https://github.com/mpdavis/python-jose/blob/3.5.0/README.rst#cryptographic-backends
37 "ecdsa"
38 "pyasn1"
39 "rsa"
40 ];
41
42 build-system = [ setuptools ];
43
44 dependencies = [
45 cryptography
46 ];
47
48 optional-dependencies = {
49 cryptography = [ cryptography ];
50 pycrypto = [ pycrypto ];
51 pycryptodome = [ pycryptodome ];
52 };
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 ]
57 ++ lib.concatAttrValues optional-dependencies;
58
59 pythonImportsCheck = [ "jose" ];
60
61 meta = {
62 description = "JOSE implementation in Python";
63 homepage = "https://github.com/mpdavis/python-jose";
64 changelog = "https://github.com/mpdavis/python-jose/releases/tag/${src.tag}";
65 license = lib.licenses.mit;
66 maintainers = [ ];
67 };
68}