nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 72 lines 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitLab, 6 openssl, 7 pytestCheckHook, 8 setuptools, 9 swig, 10}: 11 12buildPythonPackage (finalAttrs: { 13 pname = "m2crypto"; 14 version = "0.47.0"; 15 pyproject = true; 16 17 src = fetchFromGitLab { 18 owner = "m2crypto"; 19 repo = "m2crypto"; 20 tag = finalAttrs.version; 21 hash = "sha256-yOpejD2lYbv8JrTXxXOwjAgftb9xojAYgC3iKu3bDSQ="; 22 }; 23 24 # https://lists.sr.ht/~mcepl/m2crypto/%3CCAPhw1+Hg6+OJZoqt1O6aezxnTUFmfFTMzDwkD2bJ74jnmygqrg@mail.gmail.com%3E 25 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 26 substituteInPlace src/SWIG/_lib.h \ 27 --replace-fail "|| defined(__clang__)" "&& !defined(__clang__)" 28 substituteInPlace src/SWIG/_m2crypto.i \ 29 --replace-fail "PRAGMA_IGNORE_UNUSED_LABEL" "" \ 30 --replace-fail "PRAGMA_WARN_STRICT_PROTOTYPES" "" 31 ''; 32 33 build-system = [ setuptools ]; 34 35 nativeBuildInputs = [ swig ]; 36 37 buildInputs = [ openssl ]; 38 39 env = { 40 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [ 41 "-Wno-error=implicit-function-declaration" 42 "-Wno-error=incompatible-pointer-types" 43 ]); 44 OPENSSL_PATH = lib.optionalString stdenv.hostPlatform.isDarwin "${openssl.dev}"; 45 } 46 // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { 47 CPP = "${stdenv.cc.targetPrefix}cpp"; 48 }; 49 50 nativeCheckInputs = [ 51 pytestCheckHook 52 openssl 53 ]; 54 55 disabledTests = [ 56 # Connection refused 57 "test_makefile_err" 58 ]; 59 60 # Tests require localhost access 61 __darwinAllowLocalNetworking = true; 62 63 pythonImportsCheck = [ "M2Crypto" ]; 64 65 meta = { 66 description = "Python crypto and SSL toolkit"; 67 homepage = "https://gitlab.com/m2crypto/m2crypto"; 68 changelog = "https://gitlab.com/m2crypto/m2crypto/-/tags/${finalAttrs.version}"; 69 license = lib.licenses.mit; 70 maintainers = with lib.maintainers; [ sarahec ]; 71 }; 72})