summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-telegram
diff options
context:
space:
mode:
authorNikolay Korotkiy <sikmir@disroot.org>2022-07-08 00:26:06 +0300
committerNikolay Korotkiy <sikmir@disroot.org>2022-07-08 00:58:31 +0300
commit8599c7adba2d01bfd48dd3b07cb5b9759913936d (patch)
tree53169e8608a41089ed47de0cb09653bad3ef0cea /pkgs/development/python-modules/python-telegram
parent2ab39ba855a313735f0e077c922dc69de161a4a8 (diff)
pythonPackages.python-telegram: init at 0.15.0
Diffstat (limited to 'pkgs/development/python-modules/python-telegram')
-rw-r--r--pkgs/development/python-modules/python-telegram/default.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/python-telegram/default.nix b/pkgs/development/python-modules/python-telegram/default.nix
new file mode 100644
index 000000000000..0809a739be4f
--- /dev/null
+++ b/pkgs/development/python-modules/python-telegram/default.nix
@@ -0,0 +1,52 @@
+{ lib
+, stdenv
+, fetchpatch
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, setuptools
+, tdlib
+}:
+
+buildPythonPackage rec {
+ pname = "python-telegram";
+ version = "0.15.0";
+ disabled = pythonOlder "3.6";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "sha256-Na2NIiVgYexKbEqjN58hfkgxwFdCTL7Z7D3WEhL4wXA=";
+ };
+
+ patches = [
+ # Search for the system library first, and fallback to the embedded one if the system was not found
+ (fetchpatch {
+ url = "https://github.com/alexander-akhmetov/python-telegram/commit/b0af0985910ebb8940cff1b92961387aad683287.patch";
+ sha256 = "sha256-ZqsntaiC2y9l034gXDMeD2BLO/RcsbBII8FomZ65/24=";
+ })
+ ];
+
+ postPatch = ''
+ # Remove bundled libtdjson
+ rm -fr telegram/lib
+
+ substituteInPlace telegram/tdjson.py \
+ --replace "ctypes.util.find_library(\"libtdjson\")" \
+ "\"${tdlib}/lib/libtdjson${stdenv.hostPlatform.extensions.sharedLibrary}\""
+ '';
+
+ propagatedBuildInputs = [
+ setuptools
+ ];
+
+ pythonImportsCheck = [
+ "telegram.client"
+ ];
+
+ meta = with lib; {
+ description = "Python client for the Telegram's tdlib";
+ homepage = "https://github.com/alexander-akhmetov/python-telegram";
+ license = licenses.mit;
+ maintainers = with maintainers; [ sikmir ];
+ };
+}