summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorj.r2020-09-18 20:41:42 +0200
committerj.r2020-09-18 20:41:42 +0200
commit092e7e6b84d6eb14bae3cd98fcb91eae8ca4e998 (patch)
tree71c1b694736f165d6ed066a83cc3c27227c1999e
parenta52383dddb261d8e4ed8c20e583033bed3c97fc2 (diff)
downloadaur-092e7e6b84d6eb14bae3cd98fcb91eae8ca4e998.tar.gz
Add patches to use system wide tdlib
-rw-r--r--.SRCINFO4
-rw-r--r--0001-Use-system-tdlib.diff27
-rw-r--r--0002-Remove-binarys.diff15
-rw-r--r--PKGBUILD15
4 files changed, 59 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a2af22df33fb..4b65fdeeaa60 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -8,7 +8,11 @@ pkgbase = python-telegram
depends = python3
conflicts = python-telegram-bot
source = python-telegram-0.12.0.tar.gz::https://github.com/alexander-akhmetov/python-telegram/archive/0.12.0.tar.gz
+ source = 0001-Use-system-tdlib.diff
+ source = 0002-Remove-binarys.diff
md5sums = ebf3e34648e21da96e6470474e0fd7eb
+ md5sums = 287acb342038ba44bb86cdc2c6cb303b
+ md5sums = c9085c229e25cab11bffd1431c220ef1
pkgname = python-telegram
diff --git a/0001-Use-system-tdlib.diff b/0001-Use-system-tdlib.diff
new file mode 100644
index 000000000000..a5f9340cc6df
--- /dev/null
+++ b/0001-Use-system-tdlib.diff
@@ -0,0 +1,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:
diff --git a/0002-Remove-binarys.diff b/0002-Remove-binarys.diff
new file mode 100644
index 000000000000..72b1744dfb54
--- /dev/null
+++ b/0002-Remove-binarys.diff
@@ -0,0 +1,15 @@
+diff --git a/setup.py b/setup.py
+index a1ac7b0..aecc107 100644
+--- a/setup.py
++++ b/setup.py
+@@ -25,10 +25,4 @@ setup(
+ packages=[
+ 'telegram',
+ ],
+- package_data={
+- 'telegram': [
+- 'lib/darwin/*',
+- 'lib/linux/*',
+- ],
+- },
+ )
diff --git a/PKGBUILD b/PKGBUILD
index 50961a340429..f103aa6f42e8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,8 +8,19 @@ url="https://github.com/alexander-akhmetov/python-telegram"
license=('MIT')
depends=('python3')
conflicts=('python-telegram-bot')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/alexander-akhmetov/$pkgname/archive/$pkgver.tar.gz")
-md5sums=('ebf3e34648e21da96e6470474e0fd7eb')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/alexander-akhmetov/$pkgname/archive/$pkgver.tar.gz"
+ "0001-Use-system-tdlib.diff"
+ "0002-Remove-binarys.diff")
+md5sums=('ebf3e34648e21da96e6470474e0fd7eb'
+ '287acb342038ba44bb86cdc2c6cb303b'
+ 'c9085c229e25cab11bffd1431c220ef1')
+
+prepare() {
+ cd "${pkgname}-${pkgver}"
+ patch -p1 -i ${srcdir}/0001-Use-system-tdlib.diff
+ patch -p1 -i ${srcdir}/0002-Remove-binarys.diff
+ rm -r telegram/lib
+}
build() {
cd "$pkgname-$pkgver"