summarylogtreecommitdiffstats
path: root/0001-Use-system-tdlib.diff
blob: a5f9340cc6dfd06270fbc6aa06d46bff234ef397 (plain)
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
diff --git a/telegram/tdjson.py b/telegram/tdjson.py
index 091145e..21c0361 100644
--- a/telegram/tdjson.py
+++ b/telegram/tdjson.py
@@ -2,6 +2,7 @@ import json
 import logging
 import platform
 from ctypes import CDLL, CFUNCTYPE, c_int, c_char_p, c_double, c_void_p, c_longlong
+from ctypes.util import find_library
 from typing import Any, Dict, Optional, Union
 
 import pkg_resources
@@ -10,13 +11,7 @@ logger = logging.getLogger(__name__)
 
 
 def _get_tdjson_lib_path() -> str:
-    if platform.system().lower() == 'darwin':
-        lib_name = 'darwin/libtdjson.dylib'
-    else:
-        lib_name = 'linux/libtdjson.so'
-
-    return pkg_resources.resource_filename('telegram', f'lib/{lib_name}')
-
+    return find_library("tdjson")
 
 class TDJson:
     def __init__(self, library_path: Optional[str] = None, verbosity: int = 2) -> None: