Unverified Commit a64ad35d authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

python3Packages.telethon, mautrix-telethon: fix build (#499456)

parents 925ca273 a73ecb8d
Loading
Loading
Loading
Loading
+58 −55
Original line number Diff line number Diff line
{
  lib,
  python3,
  fetchPypi,
  fetchFromGitHub,
  python3,

  withE2BE ? true,
}:

let
  python = python3.override {
    self = python;
    packageOverrides = self: super: {
      tulir-telethon = self.telethon.overridePythonAttrs (oldAttrs: rec {
  tulir-telethon = python3.pkgs.telethon.overrideAttrs (
    finalAttrs: previousAttrs: {
      version = "1.99.0a6";
      pname = "tulir_telethon";
        src = fetchPypi {
          inherit pname version;
          hash = "sha256-ewqc6s5xXquZJTZVBsFmHeamBLDw6PnTSNcmTNKD0sk=";
        };
        patches = [ ];
        doCheck = false;
      });
    };
      src = fetchFromGitHub {
        owner = "tulir";
        repo = "Telethon";
        tag = "v${finalAttrs.version}";
        hash = "sha256-ulnA+xKbZDOTzXYmF9oBWNBNhgxSiF+mKx1ijoCyo/w=";
      };
      dontUsePytestCheck = true;
    }
  );
in
python.pkgs.buildPythonPackage (finalAttrs: {
python3.pkgs.buildPythonApplication (finalAttrs: {
  pname = "mautrix-telegram";
  version = "0.15.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mautrix";
@@ -34,13 +34,17 @@ python.pkgs.buildPythonPackage (finalAttrs: {
    hash = "sha256-w3BqWyAJV/lZPoOFDzxhootpw451lYruwM9efwS6cEc=";
  };

  format = "setuptools";
  build-system = with python3.pkgs; [ setuptools ];

  patches = [ ./0001-Re-add-entrypoint.patch ];

  propagatedBuildInputs =
    with python.pkgs;
    (
  pythonRelaxDeps = [
    "mautrix"
    "ruamel.yaml"
  ];

  dependencies =
    with python3.pkgs;
    [
      ruamel-yaml
      python-magic
@@ -73,8 +77,7 @@ python.pkgs.buildPythonPackage (finalAttrs: {
      python-olm
      pycryptodome
      unpaddedbase64
      ]
    );
    ];

  # has no tests
  doCheck = false;
+12 −25
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  fetchFromCodeberg,
  pythonAtLeast,
  openssl,
  rsa,
  pyaes,
@@ -12,33 +12,19 @@
  pytestCheckHook,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "telethon";
  version = "1.42.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "LonamiWebs";
  src = fetchFromCodeberg {
    owner = "Lonami";
    repo = "Telethon";
    tag = "v${version}";
    tag = "v${finalAttrs.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 finalAttrs.passthru.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/${finalAttrs.src.tag}/readthedocs/misc/changelog.rst";
    maintainers = with lib.maintainers; [ nyanloutre ];
  };
}
})