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