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 format = "setuptools";
16 pyproejct = true;
17
18 src = fetchFromGitHub {
19 owner = "snowballstem";
20 repo = "pystemmer";
21 tag = "v${version}";
22 hash = "sha256-ngPx95ybgJmndpNPBwCa3BCNsozRg+dlEw+nhlIwI58=";
23 };
24
25 patches = [
26 (fetchpatch2 {
27 # relax cython constraint
28 name = "pystemmer-relax-cython.patch";
29 url = "https://github.com/snowballstem/pystemmer/commit/d3d423dc877b4f49e0ab1776f7edaff37feb6799.patch";
30 hash = "sha256-9K6gy/cLFPfW82XYHVVPXUbQhf8XyB4NUi4YqNtyWcw=";
31 })
32 ];
33
34 build-system = [
35 cython
36 setuptools
37 ];
38
39 postConfigure = ''
40 export PYSTEMMER_SYSTEM_LIBSTEMMER="${lib.getDev libstemmer}/include"
41 '';
42
43 env.NIX_CFLAGS_COMPILE = toString [ "-I${lib.getDev libstemmer}/include" ];
44
45 NIX_CFLAGS_LINK = [ "-L${libstemmer}/lib" ];
46
47 pythonImportsCheck = [ "Stemmer" ];
48
49 checkPhase = ''
50 runHook preCheck
51 ${python.interpreter} runtests.py
52 runHook postCheck
53 '';
54
55 meta = with lib; {
56 description = "Snowball stemming algorithms, for information retrieval";
57 downloadPage = "https://github.com/snowballstem/pystemmer";
58 homepage = "http://snowball.tartarus.org/";
59 license = with licenses; [
60 bsd3
61 mit
62 ];
63 platforms = platforms.unix;
64 };
65}