1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 unittestCheckHook,
6 mock,
7 isPy3k,
8}:
9
10buildPythonPackage {
11 pname = "simplebayes";
12 version = "1.5.8";
13 format = "setuptools";
14
15 # Use GitHub instead of pypi, because it contains tests.
16 src = fetchFromGitHub {
17 repo = "simplebayes";
18 owner = "hickeroar";
19 # NOTE: This is actually 1.5.8 but the tag is wrong!
20 rev = "1.5.7";
21 sha256 = "0mp7rvfdmpfxnka4czw3lv5kkh6gdxh6dm4r6hcln1zzfg9lxp4h";
22 };
23
24 nativeCheckInputs = [
25 mock
26 unittestCheckHook
27 ];
28
29 postPatch = lib.optionalString isPy3k ''
30 sed -i -e 's/open *(\([^)]*\))/open(\1, encoding="utf-8")/' setup.py
31 '';
32
33 meta = with lib; {
34 description = "Memory-based naive bayesian text classifier";
35 homepage = "https://github.com/hickeroar/simplebayes";
36 license = licenses.mit;
37 };
38}