void-packages/srcpkgs/python3-telegram/patches/use-system-tdlib.patch
2021-05-17 12:07:28 +00:00

29 lines
1 KiB
Diff

# Patch from https://aur.archlinux.org/cgit/aur.git/plain/0001-Use-system-tdlib.diff?h=python-telegram
# Upstream issue: https://github.com/alexander-akhmetov/python-telegram/issues/119
diff --git a/telegram/tdjson.py b/telegram/tdjson.py
index 091145e..21c0361 100644
--- telegram/tdjson.py
+++ 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: