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