1{
2 lib,
3 python,
4 fetchFromGitHub,
5 fetchpatch2,
6 buildPythonPackage,
7 cython,
8 setuptools,
9 libstemmer,
10}:
11
12buildPythonPackage rec {
13 pname = "pystemmer";
14 version = "2.2.0.1";
15 pyproejct = true;
16
17 src = fetchFromGitHub {
18 owner = "snowballstem";
19 repo = "pystemmer";
20 tag = "v${version}";
21 hash = "sha256-ngPx95ybgJmndpNPBwCa3BCNsozRg+dlEw+nhlIwI58=";
22 };
23
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 ];
32
33 build-system = [
34 cython
35 setuptools
36 ];
37
38 postConfigure = ''
39 export PYSTEMMER_SYSTEM_LIBSTEMMER="${lib.getDev libstemmer}/include"
40 '';
41
42 env.NIX_CFLAGS_COMPILE = toString [ "-I${lib.getDev libstemmer}/include" ];
43
44 NIX_CFLAGS_LINK = [ "-L${libstemmer}/lib" ];
45
46 pythonImportsCheck = [ "Stemmer" ];
47
48 checkPhase = ''
49 runHook preCheck
50 ${python.interpreter} runtests.py
51 runHook postCheck
52 '';
53
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 };
64}