1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
Description: Switch to notmuch2
python3-notmuch is deprecated. python3-notmuch2 replaces it.
This patch switches notifymuch to python3-notmuch2.
Author: itd <itd@net.in.tum.de>
---
Forwarded: no
Last-Update: 2025-03-24
--- notifymuch-0.1~git20151223.0.9d4aaf5.orig/notifymuch/messages.py
+++ notifymuch-0.1~git20151223.0.9d4aaf5/notifymuch/messages.py
@@ -2,7 +2,7 @@ from email.utils import parseaddr
import os
import time
import shelve
-import notmuch
+import notmuch2
from gi.repository import GLib
from notifymuch import config
@@ -23,7 +23,7 @@ def exclude_recently_seen(messages):
if now - last_seen[k] > recency_interval:
del last_seen[k]
for message in messages:
- m_id = message.get_message_id()
+ m_id = message.messageid
if m_id not in last_seen:
last_seen[m_id] = now
yield message
@@ -110,24 +110,26 @@ def tags_prefix(tags):
def summary(messages):
return '\n'.join('{tags}{subject} ({sender}, {date})'.format(
- subject=ellipsize(message.get_header('subject')),
+ subject=ellipsize(message.header('subject')),
- sender=pretty_sender(message.get_header('from')),
+ sender=pretty_sender(message.header('from')),
- date=pretty_date(message.get_date()),
+ date=pretty_date(message.date),
- tags=tags_prefix(filter_tags(message.get_tags())))
+ tags=tags_prefix(filter_tags(message.tags)))
for message in messages)
class Messages:
def __init__(self):
- db = notmuch.Database()
+ self.db = notmuch2.Database()
- self.query = notmuch.Query(db, config.get('query'))
- self.query.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
+ self.query = lambda f: getattr(self.db, f)(
+ config.get('query'),
+ sort=notmuch2._database.QuerySortOrder.OLDEST_FIRST,
+ )
def count(self):
- return self.query.count_messages()
+ return self.query('count_messages')
def messages(self):
- return self.query.search_messages()
+ return self.query('messages')
def summary(self):
return summary(self.messages())
--- notifymuch-0.1~git20151223.0.9d4aaf5.orig/setup.py
+++ notifymuch-0.1~git20151223.0.9d4aaf5/setup.py
@@ -21,7 +21,7 @@ setup(
scripts=["bin/notifymuch"],
install_requires=[
- "notmuch",
+ "notmuch2",
"pygobject",
],
)
|