2021-05-16 21:34:02 +02:00
|
|
|
# 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
|
srcpkgs/p*: convert patches to -Np1
* par is kept at -Np0
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
for p in ${template%/template}/patches/*; do
sed -i '
\,^[+-][+-][+-] /dev/null,b
/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
s,^[*][*][*] ,&a/,
/^--- /{
s,\(^--- \)\(./\)*,\1a/,
s,[.-][Oo][Rr][Ii][Gg]\([ /]\),\1,
s/[.-][Oo][Rr][Ii][Gg]$//
s/[.]patched[.]\([^.]\)/.\1/
h
}
/^+++ -/{
g
s/^--- a/+++ b/
b
}
s,\(^+++ \)\(./\)*,\1b/,
' "$p"
done
sed -i '/^patch_args=/d' $template
done
```
2021-06-19 05:03:21 +02:00
|
|
|
--- a/telegram/tdjson.py
|
|
|
|
+++ b/telegram/tdjson.py
|
2021-05-16 21:34:02 +02:00
|
|
|
@@ -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:
|