Skip to content

Commit

Permalink
mautrix-telegram: fix application
Browse files Browse the repository at this point in the history
* 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] mautrix/telegram@a565853
Ma27 committed Nov 29, 2020
1 parent 1541df5 commit 878e80c
Showing 3 changed files with 57 additions and 5 deletions.
29 changes: 29 additions & 0 deletions pkgs/servers/mautrix-telegram/0001-Re-add-entrypoint.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From f4a612e1c8501d2a1683003bb121daa6d46155ca Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <[email protected]>
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

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From eb39954acf73096d65ba1e9575cbeb3d4307d5df Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <[email protected]>
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

9 changes: 4 additions & 5 deletions pkgs/servers/mautrix-telegram/default.nix
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 878e80c

Please sign in to comment.