Arthur Gautier 9a03bfb35d python3Packages.m2crypto: fixup darwin build
darwin builds would fail with the following output:
```
INFO:spawn:swig -python -Isystem_shadowing -Isystem_shadowing -I/nix/store/03yi1jcbkpb693las8rkq4wmakg5m8yx-apple-sdk-11.3/Platf
orms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include -I/nix/store/riv3i1wrig5kaf89wgpx46581f71gfqb-python3-3.13.5/incl
ude/python3.13 -I/usr/include/openssl -cpperraswarn -includeall -builtin -outdir build/lib.macosx-11.3-arm64-cpython-313/M2Crypt
o -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
src/SWIG/_m2crypto.i:62: Error: Unable to find 'openssl/opensslv.h'
src/SWIG/_m2crypto.i:68: Error: Unable to find 'openssl/safestack.h'
src/SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
src/SWIG/_rc4.i:5: Error: Unable to find 'openssl/opensslconf.h'
src/SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command '/nix/store/mhpryadgkrbvbslrgc6lbcz2b5yzcprq-swig-4.3.1/bin/swig' failed with exit code 1
```
2025-07-31 09:34:17 -07:00

64 lines
1.5 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
fetchurl,
openssl,
pytestCheckHook,
pythonOlder,
setuptools,
swig,
}:
buildPythonPackage rec {
pname = "m2crypto";
version = "0.45.0";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-/8ENTQmQFRT0CNx09gpNffIcROvJv3dslHv9xzWUIc8=";
};
patches = [
(fetchurl {
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";
hash = "sha256-/Bkuqu/Od+S56AUWo0ZzpZF7FGMxP766K2GJnfKXrOI=";
})
];
build-system = [ setuptools ];
nativeBuildInputs = [ swig ];
buildInputs = [ openssl ];
env = {
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
"-Wno-error=implicit-function-declaration"
"-Wno-error=incompatible-pointer-types"
]);
OPENSSL_PATH = lib.optionalString stdenv.hostPlatform.isDarwin "${openssl.dev}";
}
// lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
CPP = "${stdenv.cc.targetPrefix}cpp";
};
nativeCheckInputs = [
pytestCheckHook
openssl
];
pythonImportsCheck = [ "M2Crypto" ];
meta = with lib; {
description = "Python crypto and SSL toolkit";
homepage = "https://gitlab.com/m2crypto/m2crypto";
changelog = "https://gitlab.com/m2crypto/m2crypto/-/blob/${version}/CHANGES";
license = licenses.mit;
maintainers = [ ];
};
}