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