From 3ebcefa0ceee295f692194f381f6aa40339d3048 Mon Sep 17 00:00:00 2001 From: "j.r" Date: Tue, 21 Sep 2021 10:28:01 +0000 Subject: [PATCH] testing/py3-telegram: new aport https://github.com/alexander-akhmetov/python-telegram Python client for the Telegram's tdlib --- .../py3-telegram/0001-Use-system-tdlib.patch | 27 ++++++++++++++ .../py3-telegram/0002-Remove-binarys.patch | 15 ++++++++ testing/py3-telegram/APKBUILD | 36 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 testing/py3-telegram/0001-Use-system-tdlib.patch create mode 100644 testing/py3-telegram/0002-Remove-binarys.patch create mode 100644 testing/py3-telegram/APKBUILD diff --git a/testing/py3-telegram/0001-Use-system-tdlib.patch b/testing/py3-telegram/0001-Use-system-tdlib.patch new file mode 100644 index 00000000000..a5f9340cc6d --- /dev/null +++ b/testing/py3-telegram/0001-Use-system-tdlib.patch @@ -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/testing/py3-telegram/0002-Remove-binarys.patch b/testing/py3-telegram/0002-Remove-binarys.patch new file mode 100644 index 00000000000..72b1744dfb5 --- /dev/null +++ b/testing/py3-telegram/0002-Remove-binarys.patch @@ -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/testing/py3-telegram/APKBUILD b/testing/py3-telegram/APKBUILD new file mode 100644 index 00000000000..331ab05c3b4 --- /dev/null +++ b/testing/py3-telegram/APKBUILD @@ -0,0 +1,36 @@ +# Contributor: j.r +# Maintainer: j.r +pkgname=py3-telegram +_pyname=python-telegram +pkgver=0.14.0 +pkgrel=0 +pkgdesc="Python client for the Telegram's tdlib" +url="https://github.com/alexander-akhmetov/python-telegram" +arch="noarch !s390x !mips !mips64" +license="MIT" +depends="python3 telegram-tdlib>=1.7.0" +makedepends="py3-setuptools" +subpackages="$pkgname-doc" +source="https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz + https://raw.githubusercontent.com/alexander-akhmetov/python-telegram/$pkgver/LICENSE + 0001-Use-system-tdlib.patch + 0002-Remove-binarys.patch" +builddir="$srcdir/$_pyname-$pkgver/" +options="!check" + +build() { + python3 setup.py build +} + +package() { + python3 setup.py install --prefix=/usr --root="$pkgdir" + + install -Dm644 $srcdir/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/COPYING +} + +sha512sums=" +bea861dc6b0349aea5da60b8c2e307a0486c2069f738240b0408f7cdccfee396b51822c059da95e1716ba8dc65ec0879988cf04337f15d4ca7b64ad0f446bb0d python-telegram-0.14.0.tar.gz +b038c7b0c6138ff6f215a45d0da25ac8e3b52e3849087e90f68d3ebe246fbcd17c1f78f2ee3c020bfc759334d35709a1ac28b71c74091912dbf165785a3f5895 LICENSE +7521f123e0d3719eb8db2a6c2b120377f1ee9dbd235ad92cc91ab5b5e4ce0884692721a4fc478c8058038d24b8cae8dd8a0e5eed8d568bc769bdc80b8f2e3327 0001-Use-system-tdlib.patch +8c24db516797f8ffa8695b31be6364087ed9e6cfb9fc49bc8f68fdcb259b88dcf786afa71d30848bad50c4a201ea8d09f28fb5b86da023404f7ef6c4d17d3447 0002-Remove-binarys.patch +"