1{ stdenv
2, fetchPypi
3, buildPythonPackage
4, certifi
5, future
6, urllib3
7, tornado
8, pytest
9}:
10
11buildPythonPackage rec {
12 pname = "python-telegram-bot";
13 version = "12.3.0";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "0yrg5342zz0hpf2pc85ffwx57msa6jpcmvvjfkzh8nh2lc98aq21";
18 };
19
20 prePatch = ''
21 rm -rf telegram/vendor
22 substituteInPlace telegram/utils/request.py \
23 --replace "import telegram.vendor.ptb_urllib3.urllib3 as urllib3" "import urllib3 as urllib3" \
24 --replace "import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine" "import urllib3.contrib.appengine as appengine" \
25 --replace "from telegram.vendor.ptb_urllib3.urllib3.connection import HTTPConnection" "from urllib3.connection import HTTPConnection" \
26 --replace "from telegram.vendor.ptb_urllib3.urllib3.util.timeout import Timeout" "from urllib3.util.timeout import Timeout" \
27 --replace "from telegram.vendor.ptb_urllib3.urllib3.fields import RequestField" "from urllib3.fields import RequestField"
28
29 touch LICENSE.dual
30 '';
31
32 checkInputs = [ pytest ];
33 propagatedBuildInputs = [ certifi future urllib3 tornado ];
34
35 # tests not included with release
36 doCheck = false;
37
38 meta = with stdenv.lib; {
39 description = "This library provides a pure Python interface for the Telegram Bot API.";
40 homepage = https://python-telegram-bot.org;
41 license = licenses.lgpl3;
42 maintainers = with maintainers; [ veprbl pingiun ];
43 };
44}