1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 openssl,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10 swig,
11}:
12
13buildPythonPackage rec {
14 pname = "m2crypto";
15 version = "0.41.0";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 pname = "M2Crypto";
22 inherit version;
23 hash = "sha256-OhNYx+6EkEbZF4Knd/F4a/AnocHVG1+vjxlDW/w/FJU=";
24 };
25
26 build-system = [ setuptools ];
27
28 nativeBuildInputs = [ swig ];
29
30 buildInputs = [ openssl ];
31
32 env =
33 {
34 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin (toString [
35 "-Wno-error=implicit-function-declaration"
36 "-Wno-error=incompatible-pointer-types"
37 ]);
38 }
39 // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
40 CPP = "${stdenv.cc.targetPrefix}cpp";
41 };
42
43 nativeCheckInputs = [
44 pytestCheckHook
45 openssl
46 ];
47
48 pythonImportsCheck = [ "M2Crypto" ];
49
50 meta = with lib; {
51 description = "A Python crypto and SSL toolkit";
52 homepage = "https://gitlab.com/m2crypto/m2crypto";
53 changelog = "https://gitlab.com/m2crypto/m2crypto/-/blob/${version}/CHANGES";
54 license = licenses.mit;
55 maintainers = with maintainers; [ ];
56 };
57}