1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 openssl,
6 rsa,
7 pyaes,
8 cryptg,
9 pythonOlder,
10 setuptools,
11 pytest-asyncio,
12 pytestCheckHook,
13}:
14
15buildPythonPackage rec {
16 pname = "telethon";
17 version = "1.37.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.5";
21
22 src = fetchFromGitHub {
23 owner = "LonamiWebs";
24 repo = "Telethon";
25 tag = "v${version}";
26 hash = "sha256-P7FP+Wqi3dqbBCFpI9aCDvK4k3mWv8076RO6MXg+jFQ=";
27 };
28
29 patchPhase = ''
30 substituteInPlace telethon/crypto/libssl.py --replace-fail \
31 "ctypes.util.find_library('ssl')" "'${lib.getLib openssl}/lib/libssl.so'"
32 '';
33
34 build-system = [
35 setuptools
36 ];
37
38 dependencies = [
39 pyaes
40 rsa
41 ];
42
43 optional-dependencies = {
44 cryptg = [ cryptg ];
45 };
46
47 nativeCheckInputs = [
48 pytest-asyncio
49 pytestCheckHook
50 ];
51
52 disabledTests = [
53 # https://github.com/LonamiWebs/Telethon/issues/4254
54 "test_all_methods_present"
55 "test_private_get_extension"
56 ];
57
58 meta = {
59 homepage = "https://github.com/LonamiWebs/Telethon";
60 description = "Full-featured Telegram client library for Python 3";
61 license = lib.licenses.mit;
62 maintainers = with lib.maintainers; [ nyanloutre ];
63 };
64}