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] a565853c5e
This commit is contained in:
Maximilian Bosch 2020-11-29 21:20:50 +01:00
parent 1541df5437
commit 878e80c596
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
3 changed files with 57 additions and 5 deletions

View file

@ -0,0 +1,29 @@
From f4a612e1c8501d2a1683003bb121daa6d46155ca Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
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

View file

@ -0,0 +1,24 @@
From eb39954acf73096d65ba1e9575cbeb3d4307d5df Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
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

View file

@ -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