1{ lib
2, fetchpatch
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, swig2
7, openssl
8, typing
9}:
10
11
12buildPythonPackage rec {
13 version = "0.36.0";
14 pname = "M2Crypto";
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "1hadbdckmjzfb8qzbkafypin6sakfx35j2qx0fsivh757s7c2hhm";
19 };
20
21 patches = [
22 (fetchpatch {
23 url = "https://github.com/void-linux/void-packages/raw/7946d12eb3d815e5ecd4578f1a6133d948694370/srcpkgs/python-M2Crypto/patches/libressl.patch";
24 sha256 = "0z5qnkndg6ma5f5qqrid5m95i9kybsr000v3fdy1ab562kf65a27";
25 })
26 ];
27 patchFlags = [ "-p0" ];
28
29 nativeBuildInputs = [ swig2 ];
30 buildInputs = [ swig2 openssl ];
31
32 propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing;
33
34 preConfigure = ''
35 substituteInPlace setup.py --replace "self.openssl = '/usr'" "self.openssl = '${openssl.dev}'"
36 '';
37
38 doCheck = false; # another test that depends on the network.
39
40 meta = with lib; {
41 description = "A Python crypto and SSL toolkit";
42 homepage = "https://gitlab.com/m2crypto/m2crypto";
43 license = licenses.mit;
44 maintainers = with maintainers; [ andrew-d ];
45 };
46
47}