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