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