summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-telegram-bot/default.nix
blob: 9b70d76bfed77d9ae6d2ae63c46b0c9700c95f1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ stdenv
, fetchPypi
, buildPythonPackage
, certifi
, future
, urllib3
, tornado
, pytest
}:

buildPythonPackage rec {
  pname = "python-telegram-bot";
  version = "12.3.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0yrg5342zz0hpf2pc85ffwx57msa6jpcmvvjfkzh8nh2lc98aq21";
  };

  prePatch = ''
    rm -rf telegram/vendor
    substituteInPlace telegram/utils/request.py \
      --replace "import telegram.vendor.ptb_urllib3.urllib3 as urllib3" "import urllib3 as urllib3" \
      --replace "import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine" "import urllib3.contrib.appengine as appengine" \
      --replace "from telegram.vendor.ptb_urllib3.urllib3.connection import HTTPConnection" "from urllib3.connection import HTTPConnection" \
      --replace "from telegram.vendor.ptb_urllib3.urllib3.util.timeout import Timeout" "from urllib3.util.timeout import Timeout" \
      --replace "from telegram.vendor.ptb_urllib3.urllib3.fields import RequestField" "from urllib3.fields import RequestField"

    touch LICENSE.dual
  '';

  checkInputs = [ pytest ];
  propagatedBuildInputs = [ certifi future urllib3 tornado ];

  # tests not included with release
  doCheck = false;

  meta = with stdenv.lib; {
    description = "This library provides a pure Python interface for the Telegram Bot API.";
    homepage = https://python-telegram-bot.org;
    license = licenses.lgpl3;
    maintainers = with maintainers; [ veprbl pingiun ];
  };
}