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 patches = [ 26 ./support-openssl-3.0.10.patch 27 ]; 28 29 postPatch = '' 30 for file in oscrypto/_openssl/_lib{crypto,ssl}_c{ffi,types}.py; do 31 substituteInPlace $file \ 32 --replace "get_library('crypto', 'libcrypto.dylib', '42')" "'${openssl.out}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}'" \ 33 --replace "get_library('ssl', 'libssl', '44')" "'${openssl.out}/lib/libssl${stdenv.hostPlatform.extensions.sharedLibrary}'" 34 done 35 ''; 36 37 propagatedBuildInputs = [ 38 asn1crypto 39 ]; 40 41 nativeCheckInputs = [ 42 pytestCheckHook 43 ]; 44 45 pythonImportsCheck = [ 46 "oscrypto" 47 ]; 48 49 doCheck = !stdenv.isDarwin; 50 51 disabledTests = [ 52 # Tests require network access 53 "TLSTests" 54 "TrustListTests" 55 ]; 56 57 meta = with lib; { 58 description = "Encryption library for Python"; 59 homepage = "https://github.com/wbond/oscrypto"; 60 license = licenses.mit; 61 maintainers = with maintainers; [ ]; 62 }; 63}