From faf3a7cc022e3209db417256356fe61d3434701c Mon Sep 17 00:00:00 2001 From: Chris Ostrouchov Date: Fri, 26 Oct 2018 13:18:31 -0400 Subject: [PATCH] pythonPackages.simplebayes: refactor move to python-modules --- .../python-modules/simplebayes/default.nix | 36 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 29 +-------------- 2 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 pkgs/development/python-modules/simplebayes/default.nix diff --git a/pkgs/development/python-modules/simplebayes/default.nix b/pkgs/development/python-modules/simplebayes/default.nix new file mode 100644 index 00000000000..705b7559372 --- /dev/null +++ b/pkgs/development/python-modules/simplebayes/default.nix @@ -0,0 +1,36 @@ +{ stdenv +, buildPythonPackage +, fetchFromGitHub +, nose +, mock +, isPy3k +}: + +buildPythonPackage rec { + pname = "simplebayes"; + version = "1.5.8"; + + # 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"; + }; + + checkInputs = [ nose mock ]; + + postPatch = stdenv.lib.optionalString isPy3k '' + sed -i -e 's/open *(\([^)]*\))/open(\1, encoding="utf-8")/' setup.py + ''; + + checkPhase = "nosetests tests/test.py"; + + meta = with stdenv.lib; { + description = "Memory-based naive bayesian text classifier"; + homepage = "https://github.com/hickeroar/simplebayes"; + license = licenses.mit; + }; + +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b8409f8001f..c60c453493c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3716,34 +3716,7 @@ in { simanneal = callPackage ../development/python-modules/simanneal { }; - 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; - }; - }; + simplebayes = callPackage ../development/python-modules/simplebayes { }; simplegeneric = callPackage ../development/python-modules/simplegeneric { };