about summary refs log tree commit diff
path: root/pkgs/development/python-modules/simplebayes/default.nix
blob: bfa761b59e442d012cf6cee4d13b57522619b543 (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  unittestCheckHook,
  mock,
  isPy3k,
}:

buildPythonPackage {
  pname = "simplebayes";
  version = "1.5.8";
  format = "setuptools";

  # Use GitHub instead of pypi, because it contains tests.
  src = fetchFromGitHub {
    repo = "simplebayes";
    owner = "hickeroar";
    # NOTE: This is actually 1.5.8 but the tag is wrong!
    rev = "1.5.7";
    sha256 = "0mp7rvfdmpfxnka4czw3lv5kkh6gdxh6dm4r6hcln1zzfg9lxp4h";
  };

  nativeCheckInputs = [
    mock
    unittestCheckHook
  ];

  postPatch = lib.optionalString isPy3k ''
    sed -i -e 's/open *(\([^)]*\))/open(\1, encoding="utf-8")/' setup.py
  '';

  meta = with lib; {
    description = "Memory-based naive bayesian text classifier";
    homepage = "https://github.com/hickeroar/simplebayes";
    license = licenses.mit;
  };
}