afew: update to 4.0.1.

This commit is contained in:
rookiejet
2026-07-21 06:52:55 +07:00
committed by Đoàn Trần Công Danh
parent 1a68332046
commit 3d98f5aad9
4 changed files with 10 additions and 82 deletions
-30
View File
@@ -1,30 +0,0 @@
commit 5a67af37109c71f99de508a2d1fd074ff948d224
Author: Yann Autissier <yann.autissier@gmail.com>
Date: Mon Dec 6 19:29:57 2021 +0100
Get notmuch database path using Database wrapper
It fixes #303 and closes #267, allowing FolderNameFilter to work with
relative path in database.path of notmuch config file.
diff --git a/afew/filters/FolderNameFilter.py b/afew/filters/FolderNameFilter.py
index effe949..af8ed78 100644
--- a/afew/filters/FolderNameFilter.py
+++ b/afew/filters/FolderNameFilter.py
@@ -2,7 +2,6 @@
# Copyright (c) dtk <dtk@gmx.de>
from afew.filters.BaseFilter import Filter
-from afew.NotmuchSettings import notmuch_settings
import re
import shlex
@@ -15,7 +14,7 @@ class FolderNameFilter(Filter):
super().__init__(database)
self.__filename_pattern = '{mail_root}/(?P<maildirs>.*)/(cur|new)/[^/]+'.format(
- mail_root=notmuch_settings.get('database', 'path').rstrip('/'))
+ mail_root=database.db_path.rstrip('/'))
self.__folder_explicit_list = set(shlex.split(folder_explicit_list))
self.__folder_blacklist = set(shlex.split(folder_blacklist))
self.__folder_transforms = self.__parse_transforms(folder_transforms)
@@ -1,37 +0,0 @@
based on upstream commit d43508dc2bb456070192239d02fb8079b433781c
backports fix: HeaderMatchingFilter: Gracefully handle missing headers
diff --git a/afew/filters/HeaderMatchingFilter.py b/afew/filters/HeaderMatchingFilter.py
index 5a735f7..95198d7 100644
--- a/afew/filters/HeaderMatchingFilter.py
+++ b/afew/filters/HeaderMatchingFilter.py
@@ -6,6 +6,8 @@
from afew.filters.BaseFilter import Filter
+from notmuch.errors import NullPointerError
+
import re
@@ -22,10 +24,13 @@ class HeaderMatchingFilter(Filter):
def handle_message(self, message):
if self.header is not None and self.pattern is not None:
if not self._tag_blacklist.intersection(message.get_tags()):
- value = message.get_header(self.header)
- match = self.pattern.search(value)
- if match:
- sub = (lambda tag:
- tag.format(**match.groupdict()).lower())
- self.remove_tags(message, *map(sub, self._tags_to_remove))
- self.add_tags(message, *map(sub, self._tags_to_add))
+ try:
+ value = message.get_header(self.header)
+ match = self.pattern.search(value)
+ if match:
+ sub = (lambda tag:
+ tag.format(**match.groupdict()).lower())
+ self.remove_tags(message, *map(sub, self._tags_to_remove))
+ self.add_tags(message, *map(sub, self._tags_to_add))
+ except NullPointerError:
+ pass
-11
View File
@@ -1,11 +0,0 @@
--- ./afew/Settings.py.orig 2023-09-28 15:08:53.611940644 -0400
+++ ./afew/Settings.py 2023-09-28 15:09:06.740017084 -0400
@@ -18,7 +18,7 @@
# preserve the capitalization of the keys.
settings.optionxform = str
-settings.readfp(open(os.path.join(os.path.dirname(__file__), 'defaults', 'afew.config')))
+settings.read_file(open(os.path.join(os.path.dirname(__file__), 'defaults', 'afew.config')))
settings.read(os.path.join(user_config_dir, 'config'))
# All the values for keys listed here are interpreted as ;-delimited lists
+10 -4
View File
@@ -1,17 +1,20 @@
# Template file for 'afew'
pkgname=afew
version=3.0.1
revision=9
version=4.0.1
revision=1
build_style=python3-pep517
hostmakedepends="python3-setuptools_scm python3-Sphinx pkg-config"
depends="notmuch-python3 python3-dkimpy python3-chardet notmuch"
depends="python3-notmuch2 python3-dkimpy python3-chardet notmuch"
checkdepends="python3-pytest python3-freezegun $depends"
short_desc="Initial tagging script for notmuch mail"
maintainer="Alexander Gehrke <void@qwertyuiop.de>"
license="ISC"
homepage="https://github.com/afewmail/afew"
changelog="https://raw.githubusercontent.com/afewmail/afew/refs/heads/master/NEWS.md"
distfiles="${PYPI_SITE}/a/afew/afew-${version}.tar.gz"
checksum=ce857fe1a3bc0982c1dac81aef66cacc148e4f9db06da720f869392af1c2ee72
checksum=2cf2920f868c01112d7f963803da1ae9287996ffeeb8ba5a99c3f7e5206003f3
export SETUPTOOLS_SCM_PRETEND_VERSION=${version}
post_build() {
mkdir -p build/sphinx/man
@@ -19,6 +22,9 @@ post_build() {
}
post_install() {
cat > ${DESTDIR}/${py3_sitelib}/afew/version.py <<-EOF
version = "${version}"
EOF
vlicense LICENSE
vman build/sphinx/man/afew.1
}