summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-09-16 22:28:13 +0200
committermakefu <github@syntax-fehler.de>2020-09-16 22:28:13 +0200
commit3a93c400a3f8e58a4d10ae743fbdbada216d8641 (patch)
tree293aecc1c396d19c96599a8103878425c474b9c4
parentce41b987239abbac0f817a9ae1f7019ad9f4035a (diff)
ma pkgs.kalauerbot: init
-rw-r--r--makefu/5pkgs/kalauerbot/default.nix18
-rw-r--r--makefu/5pkgs/kalauerbot/matrixbot.patch12
-rw-r--r--makefu/5pkgs/kalauerbot/python-matrixbot.nix31
-rw-r--r--makefu/5pkgs/kalauerbot/translate.patch17
4 files changed, 78 insertions, 0 deletions
diff --git a/makefu/5pkgs/kalauerbot/default.nix b/makefu/5pkgs/kalauerbot/default.nix
new file mode 100644
index 000000000..2cecbc3f2
--- /dev/null
+++ b/makefu/5pkgs/kalauerbot/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, python3, fetchgit }:
+python3.pkgs.buildPythonPackage rec {
+name = "kalauerbot";
+rev = "08d98aa";
+ src = fetchgit {
+ url = "http://cgit.euer.krebsco.de/kalauerbot";
+ inherit rev;
+ sha256 = "017hh61smgq4zsxd10brgwmykwgwabgllxjs31xayvs1hnqmkv2v";
+ };
+ propagatedBuildInputs = with python3.pkgs;[
+ (callPackage ./python-matrixbot.nix {})
+ (stdenv.lib.overrideDerivation googletrans (self: {
+ patches = [ ./translate.patch ];
+ }))
+ ];
+ checkInputs = [ python3.pkgs.black ];
+}
+
diff --git a/makefu/5pkgs/kalauerbot/matrixbot.patch b/makefu/5pkgs/kalauerbot/matrixbot.patch
new file mode 100644
index 000000000..2b9bbbea1
--- /dev/null
+++ b/makefu/5pkgs/kalauerbot/matrixbot.patch
@@ -0,0 +1,12 @@
+diff --git a/matrixbot/matrixbot.py b/matrixbot/matrixbot.py
+index 8e5598c..d8c23d2 100644
+--- a/matrixbot/matrixbot.py
++++ b/matrixbot/matrixbot.py
+@@ -51,7 +51,6 @@ class MatrixBot:
+ self.user = None
+ if self.token is not None and self.user_id is not None:
+ self.user = self.client.get_user(self.user_id)
+- self.user.set_display_name(self.display_name)
+ self.init_rooms(self.client.rooms)
+ self.invite_listener = self.client.add_invite_listener(self.handle_invite)
+ self.cache = Cache(dbfile=cache_db)
diff --git a/makefu/5pkgs/kalauerbot/python-matrixbot.nix b/makefu/5pkgs/kalauerbot/python-matrixbot.nix
new file mode 100644
index 000000000..7bc5aa7f3
--- /dev/null
+++ b/makefu/5pkgs/kalauerbot/python-matrixbot.nix
@@ -0,0 +1,31 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, markdown
+, matrix-client
+}:
+
+buildPythonPackage rec {
+ pname = "python-matrixbot";
+ version = "0.0.7";
+ CI_COMMIT_TAG = version;
+
+ #src = ./python-matrixbot;
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "9412981b14ff3ab7ffbb1bfc1691758113ab8d71f731b3093d8808c286b69c71";
+ };
+ patches = [ ./matrixbot.patch ];
+
+ propagatedBuildInputs = [
+ markdown
+ matrix-client
+ ];
+
+ meta = with lib; {
+ description = "A basic bot for Matrix";
+ homepage = https://gitlab.com/gibberfish/python-matrixbot;
+ license = licenses.mit;
+ # maintainers = [ maintainers. ];
+ };
+}
diff --git a/makefu/5pkgs/kalauerbot/translate.patch b/makefu/5pkgs/kalauerbot/translate.patch
new file mode 100644
index 000000000..6ff820726
--- /dev/null
+++ b/makefu/5pkgs/kalauerbot/translate.patch
@@ -0,0 +1,17 @@
+diff --git a/googletrans/client.py b/googletrans/client.py
+index 89c2237..c203b44 100644
+--- a/googletrans/client.py
++++ b/googletrans/client.py
+@@ -190,6 +190,13 @@ class Translator(object):
+ pass
+ if not PY3 and isinstance(pron, unicode) and isinstance(origin, str): # pragma: nocover
+ origin = origin.decode('utf-8')
++
++ if pron is None:
++ try:
++ pron = data[0][2][2]
++ except: # pragma: nocover
++ pass
++
+ if dest in EXCLUDES and pron == origin:
+ pron = translated