From 878e80c5962b42b7b10a20a98f98319a72cb5031 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 29 Nov 2020 21:20:50 +0100 Subject: [PATCH] mautrix-telegram: fix application * In 0.9 the entrypoint got removed as it's recommended to use `python -m`[1]. However, our build layer for python relies on that, so I added a patch to re-add this. * The tests in the upstream sources appear abandoned, so those are skipped. Therefore it's also pointless to add `pytest-runner` to the `nativeBuildInputs` as it's not used and only blows up the build closure. A second patch modifies the requirements, so ow `pytest-runner` isn't needed anymore. [1] https://github.com/tulir/mautrix-telegram/commit/a565853c5e57a5671ebe4da178a5ac3d02a5005c --- .../0001-Re-add-entrypoint.patch | 29 +++++++++++++++++++ .../0002-Don-t-depend-on-pytest-runner.patch | 24 +++++++++++++++ pkgs/servers/mautrix-telegram/default.nix | 9 +++--- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 pkgs/servers/mautrix-telegram/0001-Re-add-entrypoint.patch create mode 100644 pkgs/servers/mautrix-telegram/0002-Don-t-depend-on-pytest-runner.patch diff --git a/pkgs/servers/mautrix-telegram/0001-Re-add-entrypoint.patch b/pkgs/servers/mautrix-telegram/0001-Re-add-entrypoint.patch new file mode 100644 index 00000000000..448e7017a6c --- /dev/null +++ b/pkgs/servers/mautrix-telegram/0001-Re-add-entrypoint.patch @@ -0,0 +1,29 @@ +From f4a612e1c8501d2a1683003bb121daa6d46155ca Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch +Date: Sun, 29 Nov 2020 20:45:16 +0100 +Subject: [PATCH 1/2] Re-add entrypoint + +--- + setup.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/setup.py b/setup.py +index 068c351..95dbf89 100644 +--- a/setup.py ++++ b/setup.py +@@ -51,6 +51,12 @@ setuptools.setup( + extras_require=extras_require, + python_requires="~=3.6", + ++ entry_points={ ++ 'console_scripts': [ ++ 'mautrix-telegram=mautrix_telegram.__main__:main' ++ ] ++ }, ++ + setup_requires=["pytest-runner"], + tests_require=["pytest", "pytest-asyncio", "pytest-mock"], + +-- +2.28.0 + diff --git a/pkgs/servers/mautrix-telegram/0002-Don-t-depend-on-pytest-runner.patch b/pkgs/servers/mautrix-telegram/0002-Don-t-depend-on-pytest-runner.patch new file mode 100644 index 00000000000..f1ec3e622cf --- /dev/null +++ b/pkgs/servers/mautrix-telegram/0002-Don-t-depend-on-pytest-runner.patch @@ -0,0 +1,24 @@ +From eb39954acf73096d65ba1e9575cbeb3d4307d5df Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch +Date: Sun, 29 Nov 2020 20:55:17 +0100 +Subject: [PATCH 2/2] Don't depend on pytest-runner + +--- + setup.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 95dbf89..89ea2a7 100644 +--- a/setup.py ++++ b/setup.py +@@ -57,7 +57,6 @@ setuptools.setup( + ] + }, + +- setup_requires=["pytest-runner"], + tests_require=["pytest", "pytest-asyncio", "pytest-mock"], + + classifiers=[ +-- +2.28.0 + diff --git a/pkgs/servers/mautrix-telegram/default.nix b/pkgs/servers/mautrix-telegram/default.nix index 178606ec7d6..bf00462875b 100644 --- a/pkgs/servers/mautrix-telegram/default.nix +++ b/pkgs/servers/mautrix-telegram/default.nix @@ -21,14 +21,11 @@ in buildPythonPackage rec { sha256 = "1543ljjl3jg3ayid7ifi4bamqh4gq85pmlbs3m8i7phjbbm7g9dn"; }; + patches = [ ./0001-Re-add-entrypoint.patch ./0002-Don-t-depend-on-pytest-runner.patch ]; postPatch = '' sed -i -e '/alembic>/d' requirements.txt ''; - nativeBuildInputs = [ - pytestrunner - ]; - propagatedBuildInputs = [ Mako aiohttp @@ -58,8 +55,10 @@ in buildPythonPackage rec { # Tests are broken and throw the following for every test: # TypeError: 'Mock' object is not subscriptable + # + # The tests were touched the last time in 2019 and upstream CI doesn't even build + # those, so it's safe to assume that this part of the software is abandoned. doCheck = false; - checkInputs = [ pytest pytest-mock