From 5baff4f4c43021a88bd6e5ff7a235f48f4025a61 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sat, 11 Nov 2023 00:57:52 +0400 Subject: [PATCH 1/2] python3Packages.telegram-text: init at 0.1.2 --- .../python-modules/telegram-text/default.nix | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/python-modules/telegram-text/default.nix diff --git a/pkgs/development/python-modules/telegram-text/default.nix b/pkgs/development/python-modules/telegram-text/default.nix new file mode 100644 index 000000000000..b79cd78bf4b9 --- /dev/null +++ b/pkgs/development/python-modules/telegram-text/default.nix @@ -0,0 +1,39 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, poetry-core +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "telegram-text"; + version = "0.1.2"; + pyproject = true; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "SKY-ALIN"; + repo = "telegram-text"; + rev = "v${version}"; + hash = "sha256-p8SVQq7IvkVuOFE8VDugROLY5Wk0L2HmXyacTzFFSP4="; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Python markup module for Telegram messenger"; + downloadPage = "https://github.com/SKY-ALIN/telegram-text"; + homepage = "https://telegram-text.alinsky.tech/"; + changelog = "https://github.com/SKY-ALIN/telegram-text/blob/v${version}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ sikmir ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b51096ec9919..378628abf778 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13675,6 +13675,8 @@ self: super: with self; { telfhash = callPackage ../development/python-modules/telfhash { }; + telegram-text = callPackage ../development/python-modules/telegram-text { }; + temescal = callPackage ../development/python-modules/temescal { }; temperusb = callPackage ../development/python-modules/temperusb { }; From 8e3beac69e649a4e5e5d589eab7440980b39ac3a Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sat, 11 Nov 2023 01:06:13 +0400 Subject: [PATCH 2/2] python3Packages.python-telegram: fix build --- .../python-telegram/default.nix | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/python-telegram/default.nix b/pkgs/development/python-modules/python-telegram/default.nix index 405f74bebda8..820ab03134b7 100644 --- a/pkgs/development/python-modules/python-telegram/default.nix +++ b/pkgs/development/python-modules/python-telegram/default.nix @@ -1,11 +1,12 @@ { lib , stdenv -, fetchpatch , buildPythonPackage -, fetchPypi +, fetchFromGitHub , pythonOlder , setuptools , tdlib +, telegram-text +, pytestCheckHook }: buildPythonPackage rec { @@ -13,30 +14,29 @@ buildPythonPackage rec { version = "0.18.0"; disabled = pythonOlder "3.6"; - src = fetchPypi { - inherit pname version; - hash = "sha256-UbJW/op01qe/HchfJUlBPBY9/W8NbZkEmFM8gZ5+EmI="; + src = fetchFromGitHub { + owner = "alexander-akhmetov"; + repo = "python-telegram"; + rev = version; + hash = "sha256-2Q0nUZ2TMVWznd05+fqYojkRn4xfFZJrlqb1PMuBsAY="; }; - patches = [ - # Search for the system library first, and fallback to the embedded one if the system was not found - (fetchpatch { - url = "https://github.com/alexander-akhmetov/python-telegram/commit/b0af0985910ebb8940cff1b92961387aad683287.patch"; - hash = "sha256-ZqsntaiC2y9l034gXDMeD2BLO/RcsbBII8FomZ65/24="; - }) - ]; - postPatch = '' # Remove bundled libtdjson rm -fr telegram/lib substituteInPlace telegram/tdjson.py \ - --replace "ctypes.util.find_library(\"libtdjson\")" \ + --replace "ctypes.util.find_library(\"tdjson\")" \ "\"${tdlib}/lib/libtdjson${stdenv.hostPlatform.extensions.sharedLibrary}\"" ''; propagatedBuildInputs = [ setuptools + telegram-text + ]; + + nativeCheckInputs = [ + pytestCheckHook ]; pythonImportsCheck = [