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.1";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-0PyBqIKO2/QwhDKzBAvwa7JrrZWruefUaQthGFUeduw=";
24 };
25
26 build-system = [ setuptools ];
27
28 nativeBuildInputs = [ swig ];
29
30 buildInputs = [ openssl ];
31
32 env = {
33 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
34 "-Wno-error=implicit-function-declaration"
35 "-Wno-error=incompatible-pointer-types"
36 ]);
37 OPENSSL_PATH = lib.optionalString stdenv.hostPlatform.isDarwin "${openssl.dev}";
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 = "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 = [ ];
56 };
57}