1{ stdenv
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, isPy27
6, ipaddress
7, openssl
8, cryptography_vectors
9, darwin
10, packaging
11, six
12, pythonOlder
13, isPyPy
14, cffi
15, pytest
16, pretend
17, iso8601
18, pytz
19, hypothesis
20, enum34
21}:
22
23buildPythonPackage rec {
24 pname = "cryptography";
25 version = "3.1"; # Also update the hash in vectors.nix
26
27 src = fetchPypi {
28 inherit pname version;
29 sha256 = "021yccbqr446zh1c9l8yj79h9bgbd1cwv0ppj168w9y67i3rlh16";
30 };
31
32 outputs = [ "out" "dev" ];
33
34 buildInputs = [ openssl ]
35 ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
36 propagatedBuildInputs = [
37 packaging
38 six
39 ] ++ stdenv.lib.optional (!isPyPy) cffi
40 ++ stdenv.lib.optionals isPy27 [ ipaddress enum34 ];
41
42 checkInputs = [
43 cryptography_vectors
44 hypothesis
45 iso8601
46 pretend
47 pytest
48 pytz
49 ];
50
51 checkPhase = ''
52 py.test --disable-pytest-warnings tests
53 '';
54
55 # IOKit's dependencies are inconsistent between OSX versions, so this is the best we
56 # can do until nix 1.11's release
57 __impureHostDeps = [ "/usr/lib" ];
58
59 meta = with stdenv.lib; {
60 description = "A package which provides cryptographic recipes and primitives";
61 longDescription = ''
62 Cryptography includes both high level recipes and low level interfaces to
63 common cryptographic algorithms such as symmetric ciphers, message
64 digests, and key derivation functions.
65 Our goal is for it to be your "cryptographic standard library". It
66 supports Python 2.7, Python 3.5+, and PyPy 5.4+.
67 '';
68 homepage = "https://github.com/pyca/cryptography";
69 changelog = "https://cryptography.io/en/latest/changelog/#v"
70 + replaceStrings [ "." ] [ "-" ] version;
71 license = with licenses; [ asl20 bsd3 psfl ];
72 maintainers = with maintainers; [ primeos ];
73 };
74}