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