From a7d425758a1d235615f17fae5c06cb1f87a4b53c Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 19 Dec 2016 09:56:19 +0100 Subject: [PATCH] python/simplebayes: init at 1.5.8 The upstream tag actually says 1.5.7 but the commit actually bumps the version to 1.5.8: https://github.com/hickeroar/simplebayes/commit/b8da72c50d20b6f8c0d We needed to patch the setup.py because the upstream project's setup.py reads in the README.rst for the longDescription. That very README.rst contains non-ASCII characters which in turn throws a decoding error with Python 3 on Nix because I think this has to do with our setup.py wrapper that doesn't seem to recognize the right encoding when using compile(). Tested by building against Python 2.7, 3.3, 3.4, 3.5 and 3.6. Signed-off-by: aszlig --- pkgs/top-level/python-packages.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a3c42dd13bf..f4a425b2673 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -23135,6 +23135,35 @@ in { }; }; + simplebayes = buildPythonPackage rec { + name = "simplebayes-${version}"; + version = "1.5.8"; + + # Use GitHub instead of pypi, because it contains tests. + src = pkgs.fetchFromGitHub { + repo = "simplebayes"; + owner = "hickeroar"; + # NOTE: This is actually 1.5.8 but the tag is wrong! + rev = "1.5.7"; + sha256 = "0mp7rvfdmpfxnka4czw3lv5kkh6gdxh6dm4r6hcln1zzfg9lxp4h"; + }; + + checkInputs = [ self.nose self.mock ]; + + postPatch = optionalString isPy3k '' + sed -i -e 's/open *(\([^)]*\))/open(\1, encoding="utf-8")/' setup.py + ''; + + checkPhase = "nosetests tests/test.py"; + + meta = { + description = "Memory-based naive bayesian text classifier"; + homepage = "https://github.com/hickeroar/simplebayes"; + license = licenses.mit; + platforms = platforms.all; + }; + }; + simplegeneric = buildPythonPackage rec { version = "0.8.1"; name = "simplegeneric-${version}";