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 = "11.1.0";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "cca4e32ebb8da7fdf35ab2fa2b3edd441211364819c5592fc253acdb7561ea5b";
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
28 touch LICENSE.dual
29 '';
30
31 checkInputs = [ pytest ];
32 propagatedBuildInputs = [ certifi future urllib3 tornado ];
33
34 # tests not included with release
35 doCheck = false;
36
37 meta = with stdenv.lib; {
38 description = "This library provides a pure Python interface for the Telegram Bot API.";
39 homepage = https://python-telegram-bot.org;
40 license = licenses.lgpl3;
41 maintainers = with maintainers; [ veprbl ];
42 };
43}