btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / development / python-modules / pystemmer / default.nix
blobbddc42a816b0bb3241b5c396a659fee4bb62661a
2   lib,
3   python,
4   fetchFromGitHub,
5   fetchpatch2,
6   buildPythonPackage,
7   cython,
8   setuptools,
9   libstemmer,
12 buildPythonPackage rec {
13   pname = "pystemmer";
14   version = "2.2.0.1";
15   pyproejct = true;
17   src = fetchFromGitHub {
18     owner = "snowballstem";
19     repo = "pystemmer";
20     rev = "refs/tags/v${version}";
21     hash = "sha256-ngPx95ybgJmndpNPBwCa3BCNsozRg+dlEw+nhlIwI58=";
22   };
24   patches = [
25     (fetchpatch2 {
26       # relax cython constraint
27       name = "pystemmer-relax-cython.patch";
28       url = "https://github.com/snowballstem/pystemmer/commit/d3d423dc877b4f49e0ab1776f7edaff37feb6799.patch";
29       hash = "sha256-9K6gy/cLFPfW82XYHVVPXUbQhf8XyB4NUi4YqNtyWcw=";
30     })
31   ];
33   build-system = [
34     cython
35     setuptools
36   ];
38   postConfigure = ''
39     export PYSTEMMER_SYSTEM_LIBSTEMMER="${lib.getDev libstemmer}/include"
40   '';
42   env.NIX_CFLAGS_COMPILE = toString [ "-I${lib.getDev libstemmer}/include" ];
44   NIX_CFLAGS_LINK = [ "-L${libstemmer}/lib" ];
46   pythonImportsCheck = [ "Stemmer" ];
48   checkPhase = ''
49     runHook preCheck
50     ${python.interpreter} runtests.py
51     runHook postCheck
52   '';
54   meta = with lib; {
55     description = "Snowball stemming algorithms, for information retrieval";
56     downloadPage = "https://github.com/snowballstem/pystemmer";
57     homepage = "http://snowball.tartarus.org/";
58     license = with licenses; [
59       bsd3
60       mit
61     ];
62     platforms = platforms.unix;
63   };