1{ lib
2, buildPythonPackage
3, dnspython
4, fetchPypi
5, geoip2
6, ipython
7, isPyPy
8, praw
9, pyenchant
10, pygeoip
11, pytestCheckHook
12, pythonOlder
13, pytz
14, sqlalchemy
15, xmltodict
16}:
17
18buildPythonPackage rec {
19 pname = "sopel";
20 version = "7.1.9";
21 format = "setuptools";
22
23 disabled = isPyPy || pythonOlder "3.7";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-IJ+ovLQv6/UU1oepmUQjzaWBG3Rdd3xvui7FjK85Urs=";
28 };
29
30 patches = [
31 # https://github.com/sopel-irc/sopel/issues/2401
32 # https://github.com/sopel-irc/sopel/commit/596adc44330939519784389cbb927435305ef758.patch
33 # rewrite the patch because there are too many patches needed to apply the above patch.
34 ./python311-support.patch
35 ];
36
37 propagatedBuildInputs = [
38 dnspython
39 geoip2
40 ipython
41 praw
42 pyenchant
43 pygeoip
44 pytz
45 sqlalchemy
46 xmltodict
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 ];
52
53 postPatch = ''
54 substituteInPlace requirements.txt \
55 --replace "praw>=4.0.0,<6.0.0" "praw" \
56 --replace "sqlalchemy<1.4" "sqlalchemy" \
57 --replace "xmltodict==0.12" "xmltodict>=0.12"
58 '';
59
60 preCheck = ''
61 export TESTDIR=$(mktemp -d)
62 cp -R ./test $TESTDIR
63 pushd $TESTDIR
64 '';
65
66 postCheck = ''
67 popd
68 '';
69
70 pythonImportsCheck = [
71 "sopel"
72 ];
73
74 meta = with lib; {
75 description = "Simple and extensible IRC bot";
76 homepage = "https://sopel.chat";
77 license = licenses.efl20;
78 maintainers = with maintainers; [ mog ];
79 };
80}