mautrix-telegram: fix build

With updating `pluggy` to `0.13.0`[1] the way how python modules are
imported during pytest changed which broke all modules that had a
`coding: future_fstrings` annotation at the top which used to be needed
for python <=3.5. This only affected the tests, deploying a
`mautrix-telegram` from master with `doCheck = false;` works fine.

I applied a patch for `mautrix-telegram` which drops python 3.5 compat
(this package is intended to be used as application with python 3.7, so this
should be fine on master/unstable) and modified `mautrix-appservice`
accordingly as a lot of things on master changed since their last
release, so applying a patch didn't work there.

Resolves #71996

[1] faf8cfba4e
wip/yesman
Maximilian Bosch 5 years ago
parent e478127e80
commit 22470fff35
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
  1. 53
      pkgs/development/python-modules/mautrix-appservice/0001-Remove-coding-annotations.patch
  2. 4
      pkgs/development/python-modules/mautrix-appservice/default.nix
  3. 11
      pkgs/servers/mautrix-telegram/default.nix

@ -0,0 +1,53 @@
From 6750cda26821f703b120ba5c925cc696200570d3 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Sat, 26 Oct 2019 10:31:02 +0200
Subject: [PATCH] Remove coding annotations
Those used to be needed for Python <=3.5. With `pluggy` 0.13.0 this breaks
tests on newer python3 versions.
---
mautrix_appservice/appservice.py | 1 -
mautrix_appservice/errors.py | 1 -
mautrix_appservice/intent_api.py | 1 -
mautrix_appservice/state_store.py | 1 -
4 files changed, 4 deletions(-)
diff --git a/mautrix_appservice/appservice.py b/mautrix_appservice/appservice.py
index 3a141b1..47e37fe 100644
--- a/mautrix_appservice/appservice.py
+++ b/mautrix_appservice/appservice.py
@@ -1,4 +1,3 @@
-# -*- coding: future_fstrings -*-
# Partly based on github.com/Cadair/python-appservice-framework (MIT license)
from contextlib import contextmanager
from typing import Optional, Callable, Awaitable, Union
diff --git a/mautrix_appservice/errors.py b/mautrix_appservice/errors.py
index 90d040f..702f541 100644
--- a/mautrix_appservice/errors.py
+++ b/mautrix_appservice/errors.py
@@ -1,4 +1,3 @@
-# -*- coding: future_fstrings -*-
from typing import Optional
diff --git a/mautrix_appservice/intent_api.py b/mautrix_appservice/intent_api.py
index 4021bf8..7236cbb 100644
--- a/mautrix_appservice/intent_api.py
+++ b/mautrix_appservice/intent_api.py
@@ -1,4 +1,3 @@
-# -*- coding: future_fstrings -*-
from urllib.parse import quote as urllib_quote
from time import time
from json.decoder import JSONDecodeError
diff --git a/mautrix_appservice/state_store.py b/mautrix_appservice/state_store.py
index 47bb970..6ebec2a 100644
--- a/mautrix_appservice/state_store.py
+++ b/mautrix_appservice/state_store.py
@@ -1,4 +1,3 @@
-# -*- coding: future_fstrings -*-
from typing import Optional
from abc import ABC, abstractmethod
import json
--
2.23.0

@ -9,6 +9,10 @@ buildPythonPackage rec {
sha256 = "60192920cff75afdd096eea3a43276e33ec15f4f00bd04d2d1dda616c84f22a5";
};
patches = lib.optional (!(pythonOlder "3.6")) [
./0001-Remove-coding-annotations.patch
];
propagatedBuildInputs = [
aiohttp
future-fstrings

@ -1,4 +1,4 @@
{ lib, python3, mautrix-telegram }:
{ lib, python3, mautrix-telegram, fetchpatch }:
with python3.pkgs;
@ -11,6 +11,15 @@ buildPythonPackage rec {
sha256 = "1lsi6x5yr8f9yjxsh1rmcd6wnxr6s6rpr720lg7sq629m42d9p1d";
};
patches = [
(fetchpatch {
url = https://github.com/tulir/mautrix-telegram/commit/be6d395ed66d86ec7f13a262f9ae37731987019c.patch;
sha256 = "1q69ip17r45yhyrxr0pj8bvqj2grw2l39wak8pi5pm7qrxra93j2";
})
];
disabled = pythonOlder "3.6";
postPatch = ''
sed -i -e '/alembic>/d' setup.py
'';

Loading…
Cancel
Save