1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, pythonOlder 6, setuptools 7, tdlib 8, telegram-text 9, pytestCheckHook 10}: 11 12buildPythonPackage rec { 13 pname = "python-telegram"; 14 version = "0.18.0"; 15 disabled = pythonOlder "3.6"; 16 17 src = fetchFromGitHub { 18 owner = "alexander-akhmetov"; 19 repo = "python-telegram"; 20 rev = version; 21 hash = "sha256-2Q0nUZ2TMVWznd05+fqYojkRn4xfFZJrlqb1PMuBsAY="; 22 }; 23 24 postPatch = '' 25 # Remove bundled libtdjson 26 rm -fr telegram/lib 27 28 substituteInPlace telegram/tdjson.py \ 29 --replace "ctypes.util.find_library(\"tdjson\")" \ 30 "\"${tdlib}/lib/libtdjson${stdenv.hostPlatform.extensions.sharedLibrary}\"" 31 ''; 32 33 propagatedBuildInputs = [ 34 setuptools 35 telegram-text 36 ]; 37 38 nativeCheckInputs = [ 39 pytestCheckHook 40 ]; 41 42 disabledTests = [ 43 "TestGetTdjsonTdlibPath" 44 ]; 45 46 pythonImportsCheck = [ 47 "telegram.client" 48 ]; 49 50 meta = with lib; { 51 description = "Python client for the Telegram's tdlib"; 52 homepage = "https://github.com/alexander-akhmetov/python-telegram"; 53 license = licenses.mit; 54 maintainers = with maintainers; [ sikmir ]; 55 }; 56}