1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 openssl,
6 rsa,
7 pyaes,
8 pythonOlder,
9 setuptools,
10 pytest-asyncio,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "telethon";
16 version = "1.26.1";
17 format = "pyproject";
18 disabled = pythonOlder "3.5";
19
20 src = fetchFromGitHub {
21 owner = "LonamiWebs";
22 repo = "Telethon";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-RxnC+PVSnLeCZ1xap6n6CjpeA8Ig6oLGiB0LDxqUmsA=";
25 };
26
27 patchPhase = ''
28 substituteInPlace telethon/crypto/libssl.py --replace \
29 "ctypes.util.find_library('ssl')" "'${lib.getLib openssl}/lib/libssl.so'"
30 '';
31
32 nativeBuildInputs = [ setuptools ];
33
34 propagatedBuildInputs = [
35 rsa
36 pyaes
37 ];
38
39 nativeCheckInputs = [
40 pytest-asyncio
41 pytestCheckHook
42 ];
43
44 pytestFlagsArray = [ "tests/telethon" ];
45
46 meta = with lib; {
47 homepage = "https://github.com/LonamiWebs/Telethon";
48 description = "Full-featured Telegram client library for Python 3";
49 license = licenses.mit;
50 maintainers = with maintainers; [ nyanloutre ];
51 };
52}