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