1{ lib 2, stdenv 3, asn1crypto 4, buildPythonPackage 5, fetchFromGitHub 6, openssl 7, pytestCheckHook 8, pythonOlder 9}: 10 11buildPythonPackage rec { 12 pname = "oscrypto"; 13 version = "1.3.0"; 14 format = "setuptools"; 15 16 disabled = pythonOlder "3.7"; 17 18 src = fetchFromGitHub { 19 owner = "wbond"; 20 repo = pname; 21 rev = version; 22 hash = "sha256-CmDypmlc/kb6ONCUggjT1Iqd29xNSLRaGh5Hz36dvOw="; 23 }; 24 25 postPatch = '' 26 for file in oscrypto/_openssl/_lib{crypto,ssl}_c{ffi,types}.py; do 27 substituteInPlace $file \ 28 --replace "get_library('crypto', 'libcrypto.dylib', '42')" "'${openssl.out}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}'" \ 29 --replace "get_library('ssl', 'libssl', '44')" "'${openssl.out}/lib/libssl${stdenv.hostPlatform.extensions.sharedLibrary}'" 30 done 31 ''; 32 33 propagatedBuildInputs = [ 34 asn1crypto 35 ]; 36 37 checkInputs = [ 38 pytestCheckHook 39 ]; 40 41 pythonImportsCheck = [ 42 "oscrypto" 43 ]; 44 45 doCheck = !stdenv.isDarwin; 46 47 disabledTests = [ 48 # Tests require network access 49 "TLSTests" 50 "TrustListTests" 51 ]; 52 53 meta = with lib; { 54 description = "Encryption library for Python"; 55 homepage = "https://github.com/wbond/oscrypto"; 56 license = licenses.mit; 57 maintainers = with maintainers; [ ]; 58 }; 59}