1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchPypi, 6 fetchurl, 7 openssl, 8 pytestCheckHook, 9 pythonOlder, 10 setuptools, 11 swig, 12}: 13 14buildPythonPackage rec { 15 pname = "m2crypto"; 16 version = "0.45.0"; 17 pyproject = true; 18 19 disabled = pythonOlder "3.7"; 20 21 src = fetchPypi { 22 inherit pname version; 23 hash = "sha256-/8ENTQmQFRT0CNx09gpNffIcROvJv3dslHv9xzWUIc8="; 24 }; 25 patches = [ 26 (fetchurl { 27 url = "https://sources.debian.org/data/main/m/m2crypto/0.42.0-2.1/debian/patches/0004-swig-Workaround-for-reading-sys-select.h-ending-with.patch"; 28 hash = "sha256-/Bkuqu/Od+S56AUWo0ZzpZF7FGMxP766K2GJnfKXrOI="; 29 }) 30 ]; 31 32 build-system = [ setuptools ]; 33 34 nativeBuildInputs = [ swig ]; 35 36 buildInputs = [ openssl ]; 37 38 env = 39 { 40 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [ 41 "-Wno-error=implicit-function-declaration" 42 "-Wno-error=incompatible-pointer-types" 43 ]); 44 } 45 // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { 46 CPP = "${stdenv.cc.targetPrefix}cpp"; 47 }; 48 49 nativeCheckInputs = [ 50 pytestCheckHook 51 openssl 52 ]; 53 54 pythonImportsCheck = [ "M2Crypto" ]; 55 56 meta = with lib; { 57 description = "Python crypto and SSL toolkit"; 58 homepage = "https://gitlab.com/m2crypto/m2crypto"; 59 changelog = "https://gitlab.com/m2crypto/m2crypto/-/blob/${version}/CHANGES"; 60 license = licenses.mit; 61 maintainers = [ ]; 62 }; 63}