From 22470fff35a2b4de1a898175675dace9f627fdeb Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 26 Oct 2019 10:40:14 +0200 Subject: [PATCH] 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] faf8cfba4ecd86186bb2d965f6d6386a08aba6a6 --- .../0001-Remove-coding-annotations.patch | 53 +++++++++++++++++++ .../mautrix-appservice/default.nix | 4 ++ pkgs/servers/mautrix-telegram/default.nix | 11 +++- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/mautrix-appservice/0001-Remove-coding-annotations.patch diff --git a/pkgs/development/python-modules/mautrix-appservice/0001-Remove-coding-annotations.patch b/pkgs/development/python-modules/mautrix-appservice/0001-Remove-coding-annotations.patch new file mode 100644 index 00000000000..d00264efe8c --- /dev/null +++ b/pkgs/development/python-modules/mautrix-appservice/0001-Remove-coding-annotations.patch @@ -0,0 +1,53 @@ +From 6750cda26821f703b120ba5c925cc696200570d3 Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch +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 + diff --git a/pkgs/development/python-modules/mautrix-appservice/default.nix b/pkgs/development/python-modules/mautrix-appservice/default.nix index ba96e7d734b..41ad167929a 100644 --- a/pkgs/development/python-modules/mautrix-appservice/default.nix +++ b/pkgs/development/python-modules/mautrix-appservice/default.nix @@ -9,6 +9,10 @@ buildPythonPackage rec { sha256 = "60192920cff75afdd096eea3a43276e33ec15f4f00bd04d2d1dda616c84f22a5"; }; + patches = lib.optional (!(pythonOlder "3.6")) [ + ./0001-Remove-coding-annotations.patch + ]; + propagatedBuildInputs = [ aiohttp future-fstrings diff --git a/pkgs/servers/mautrix-telegram/default.nix b/pkgs/servers/mautrix-telegram/default.nix index 2908c14b4e0..415609e77c2 100644 --- a/pkgs/servers/mautrix-telegram/default.nix +++ b/pkgs/servers/mautrix-telegram/default.nix @@ -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 '';