summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pymilter/default.nix
blob: a54d852e3b831471a0468d335d438b8710eee2fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  libmilter,
  berkeleydb,
  py3dns,
  pyasyncore,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pymilter";
  version = "1.0.6";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "sdgathman";
    repo = "pymilter";
    tag = "pymilter-${version}";
    hash = "sha256-plaWXwDAIsVzEtrabZuZj7T4WNfz2ntQHgcMCVf5S70=";
  };

  build-system = [
    setuptools
  ];

  buildInputs = [ libmilter ];

  nativeCheckInputs = [
    pyasyncore
  ];

  dependencies = [
    berkeleydb
    py3dns
  ];

  preBuild = ''
    substituteInPlace Milter/greylist.py \
      --replace-fail "import thread" "import _thread as thread"
  '';

  # testpolicy: requires makemap (#100419)
  #   using exec -a makemap smtpctl results in "unknown group smtpq"
  preCheck = ''
    sed -i '/testpolicy/d' test.py
    rm testpolicy.py
  '';

  pythonImportsCheck = [ "Milter" ];

  meta = {
    homepage = "http://bmsi.com/python/milter.html";
    description = "Python bindings for libmilter api";
    maintainers = with lib.maintainers; [ yorickvp ];
    license = lib.licenses.gpl2;
  };
}