about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/python-telegram/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/python-telegram/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/python-telegram/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/python-telegram/default.nix b/nixpkgs/pkgs/development/python-modules/python-telegram/default.nix
new file mode 100644
index 000000000000..50a14d6ccc27
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/python-telegram/default.nix
@@ -0,0 +1,56 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, fetchFromGitHub
+, pythonOlder
+, setuptools
+, tdlib
+, telegram-text
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "python-telegram";
+  version = "0.18.0";
+  disabled = pythonOlder "3.6";
+
+  src = fetchFromGitHub {
+    owner = "alexander-akhmetov";
+    repo = "python-telegram";
+    rev = version;
+    hash = "sha256-2Q0nUZ2TMVWznd05+fqYojkRn4xfFZJrlqb1PMuBsAY=";
+  };
+
+  postPatch = ''
+    # Remove bundled libtdjson
+    rm -fr telegram/lib
+
+    substituteInPlace telegram/tdjson.py \
+      --replace "ctypes.util.find_library(\"tdjson\")" \
+                "\"${tdlib}/lib/libtdjson${stdenv.hostPlatform.extensions.sharedLibrary}\""
+  '';
+
+  propagatedBuildInputs = [
+    setuptools
+    telegram-text
+  ];
+
+  nativeCheckInputs = [
+    pytestCheckHook
+  ];
+
+  disabledTests = [
+    "TestGetTdjsonTdlibPath"
+  ];
+
+  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 ];
+  };
+}