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