nixpkgs/pkgs/development/python-modules/m2crypto/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

49 lines
1.1 KiB
Nix

{ stdenv
, lib
, fetchpatch
, buildPythonPackage
, fetchPypi
, pythonOlder
, swig2
, openssl
, typing
}:
buildPythonPackage rec {
version = "0.36.0";
pname = "M2Crypto";
src = fetchPypi {
inherit pname version;
sha256 = "1hadbdckmjzfb8qzbkafypin6sakfx35j2qx0fsivh757s7c2hhm";
};
patches = [
(fetchpatch {
url = "https://github.com/void-linux/void-packages/raw/7946d12eb3d815e5ecd4578f1a6133d948694370/srcpkgs/python-M2Crypto/patches/libressl.patch";
sha256 = "0z5qnkndg6ma5f5qqrid5m95i9kybsr000v3fdy1ab562kf65a27";
})
];
patchFlags = [ "-p0" ];
nativeBuildInputs = [ swig2 ];
buildInputs = [ swig2 openssl ];
propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing;
preConfigure = ''
substituteInPlace setup.py --replace "self.openssl = '/usr'" "self.openssl = '${openssl.dev}'"
'';
doCheck = false; # another test that depends on the network.
meta = with lib; {
description = "A Python crypto and SSL toolkit";
homepage = "https://gitlab.com/m2crypto/m2crypto";
license = licenses.mit;
maintainers = with maintainers; [ andrew-d ];
};
}