From: AnInternetTroll <AnInternetTroll@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] toot: add shell completion.
Date: Sat, 06 Apr 2024 19:16:36 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-49732@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
There is a new pull request by AnInternetTroll against master on the void-packages repository
https://github.com/AnInternetTroll/void-packages user/luca/toot
https://github.com/void-linux/void-packages/pull/49732
toot: add shell completion.
#### Testing the changes
- I tested the changes in this PR: **YES**
#### Local build testing
- I built this PR locally for my native architecture, (x86\_64-glibc)
A patch file from https://github.com/void-linux/void-packages/pull/49732.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-user/luca/toot-49732.patch --]
[-- Type: text/x-diff, Size: 2967 bytes --]
From 3fd8a386e3dfc788f39b960426c670ddfab58dff Mon Sep 17 00:00:00 2001
From: Luca Matei Pintilie <luca@lucamatei.com>
Date: Sat, 6 Apr 2024 19:15:09 +0200
Subject: [PATCH] toot: add shell completion.
---
srcpkgs/toot/patches/version-check.patch | 30 ++++++++++++++++++++++++
srcpkgs/toot/template | 10 +++++++-
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/toot/patches/version-check.patch
diff --git a/srcpkgs/toot/patches/version-check.patch b/srcpkgs/toot/patches/version-check.patch
new file mode 100644
index 00000000000000..7176b4fe220053
--- /dev/null
+++ b/srcpkgs/toot/patches/version-check.patch
@@ -0,0 +1,30 @@
+From 1d48e6485359df24a9f52610d8b66565b54e869f Mon Sep 17 00:00:00 2001
+From: Luca Matei Pintilie <luca@lucamatei.com>
+Date: Sat, 6 Apr 2024 12:57:39 +0200
+Subject: [PATCH] Fix version check in case of an empty string
+
+Some mastodon implementations (GoToSocial) will return `version: ""`, in
+which case checking for the major version won't work.
+
+This is why an extra check has to be added, and default to 0 as the
+"major" version.
+---
+ toot/tui/app.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/toot/tui/app.py b/toot/tui/app.py
+index 8278ef71..1fcfd413 100644
+--- a/toot/tui/app.py
++++ b/toot/tui/app.py
+@@ -327,8 +327,10 @@ def _done(instance):
+ # get the major version number of the server
+ # this works for Mastodon and Pleroma version strings
+ # Mastodon versions < 4 do not have translation service
++ # If the version is missing, assume 0 as a fallback
+ # Revisit this logic if Pleroma implements translation
+- ch = instance["version"][0]
++ version = instance["version"]
++ ch = "0" if not version else version[0]
+ self.can_translate = int(ch) > 3 if ch.isnumeric() else False
+
+ return self.run_in_thread(_load_instance, done_callback=_done)
diff --git a/srcpkgs/toot/template b/srcpkgs/toot/template
index 251276fea759ae..0ca1d1afe82a4d 100644
--- a/srcpkgs/toot/template
+++ b/srcpkgs/toot/template
@@ -1,7 +1,7 @@
# Template file for 'toot'
pkgname=toot
version=0.42.0
-revision=1
+revision=2
build_style=python3-pep517
hostmakedepends="python3-setuptools python3-wheel"
depends="python3-click python3-requests python3-BeautifulSoup4 python3-wcwidth
@@ -14,3 +14,11 @@ homepage="https://toot.bezdomni.net"
changelog="https://raw.githubusercontent.com/ihabunek/toot/master/CHANGELOG.md"
distfiles="https://github.com/ihabunek/toot/archive/refs/tags/${version}.tar.gz"
checksum=05502896b3a75aa93c8895bab75669653601af502ac6cf44d1ab33de373ef229
+
+post_install() {
+ for shell in bash zsh fish; do
+ _TOOT_COMPLETE=${shell}_source PYTHONPATH="${DESTDIR}/${py3_sitelib}" \
+ $DESTDIR/usr/bin/toot > completion.$shell
+ vcompletion completion.$shell $shell
+ done
+}
next reply other threads:[~2024-04-06 17:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-06 17:16 AnInternetTroll [this message]
2024-04-06 17:31 ` [PR PATCH] [Updated] " AnInternetTroll
2024-04-06 17:34 ` AnInternetTroll
2024-04-09 21:51 ` cinerea0
2024-04-10 4:42 ` AnInternetTroll
2024-04-14 7:57 ` [PR PATCH] [Updated] " AnInternetTroll
2024-04-14 8:18 ` [PR PATCH] [Updated] toot: update to 0.43 & " AnInternetTroll
2024-04-14 8:19 ` AnInternetTroll
2024-04-14 8:22 ` AnInternetTroll
2024-04-14 8:35 ` AnInternetTroll
2024-05-31 18:59 ` [PR PATCH] [Merged]: " classabbyamp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-49732@inbox.vuxu.org \
--to=aninternettroll@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).