Commit f3109edf authored by Sarah Clark's avatar Sarah Clark
Browse files

python3Packages.telethon: fix build

parent be288195
Loading
Loading
Loading
Loading
+9 −22
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  fetchFromCodeberg,
  pythonAtLeast,
  openssl,
  rsa,
  pyaes,
@@ -17,28 +17,14 @@ buildPythonPackage rec {
  version = "1.42.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "LonamiWebs";
  src = fetchFromCodeberg {
    owner = "Lonami";
    repo = "Telethon";
    tag = "v${version}";
    hash = "sha256-NMHJkSTGR3/tck0k97EfVN9f85PAWst+EZ6G7Tgrt5s=";
  };

  patches = [
    # https://github.com/LonamiWebs/Telethon/pull/4670
    (fetchpatch {
      url = "https://github.com/LonamiWebs/Telethon/commit/8e2a46568ef9193f5887aea1abf919ac4ca6d31e.patch";
      name = "fix_async_test.patch";
      hash = "sha256-oVpLnO4OxNam/mq945OskVEHkbS5TDSUXk/0xPHVv3I=";
    })
  ]
  ++ lib.optionals (lib.versionOlder version "1.40.1") [
    (fetchpatch {
      url = "https://github.com/LonamiWebs/Telethon/commit/ae9c798e2c3648ff40dee1b3f371f5d66851642e.patch";
      name = "fix_test_messages_test.patch";
      hash = "sha256-8SJm8EE6w7zRQxt1NuTX6KP1MTYPiYO/maJ5tOA2I9w=";
    })
  ];
  disabled = pythonAtLeast "3.14";

  postPatch = ''
    substituteInPlace telethon/crypto/libssl.py --replace-fail \
@@ -61,13 +47,14 @@ buildPythonPackage rec {
  nativeCheckInputs = [
    pytest-asyncio
    pytestCheckHook
  ];
  ]
  ++ lib.concatAttrValues optional-dependencies;

  meta = {
    homepage = "https://github.com/LonamiWebs/Telethon";
    homepage = "https://codeberg.org/Lonami/Telethon";
    description = "Full-featured Telegram client library for Python 3";
    license = lib.licenses.mit;
    changelog = "https://github.com/LonamiWebs/Telethon/blob/${src.tag}/readthedocs/misc/changelog.rst";
    changelog = "https://codeberg.org/Lonami/Telethon/blob/${src.tag}/readthedocs/misc/changelog.rst";
    maintainers = with lib.maintainers; [ nyanloutre ];
  };
}