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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
|
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,24 +7,32 @@
build-ubuntu:
strategy:
matrix:
- python: [3.6, 3.7, 3.8]
- name: Build (Python ${{ matrix.python }})
- runs-on: ubuntu-18.04
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ name: Build (Python ${{ matrix.python-version }})
+ runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- - name: Set up Python
+ with:
+ fetch-depth: 0
+ - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
- python-version: '${{ matrix.python }}'
+ python-version: '${{ matrix.python-version }}'
+ - name: Display Python version
+ run: python -c "import sys; print(sys.version)"
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
- sudo apt-get install -y notmuch python3-notmuch python3-venv
+ sudo apt-get install -y notmuch python3-notmuch python3-venv flake8
python3 -m venv env
source ./env/bin/activate
- pip install setuptools pytest dkimpy
+ pip install setuptools setuptools_scm pytest dkimpy
ln -s /usr/lib/python3/dist-packages/notmuch ./env/lib/python*/site-packages
+ - name: flake8 lint
+ run: |
+ source ./env/bin/activate
+ flake8 --ignore=E501,W504 afew/
- name: Tests
run: |
source ./env/bin/activate
@@ -38,20 +46,9 @@
run: |
source ./env/bin/activate
python setup.py install
- - name: Generate coverage report
- run: |
- source ./env/bin/activate
- pip install pytest-cov
- pytest --cov=./ --cov-report=xml
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v1
- with:
- file: ./coverage.xml
- flags: unittests
- name: codecov-umbrella
- fail_ci_if_error: true
- name: Docs
run: |
source ./env/bin/activate
pip install sphinx
- python setup.py build_sphinx -b html,man
+ sphinx-build -b html docs $(mktemp -d)
+ sphinx-build -b man docs $(mktemp -d)
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,31 @@
+name: Release
+
+on:
+ release:
+ types:
+ - published
+
+jobs:
+ release:
+ needs: [build-ubuntu]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install setuptools setuptools_scm wheel twine
+ - name: Build and publish (testpypi)
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.testpypi_token }}
+ TWINE_REPOSITORY: testpypi
+ run: |
+ python setup.py sdist
+ twine upload dist/*
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,22 @@
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: docs/conf.py
+
+# We recommend specifying your dependencies to enable reproducible builds:
+# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+# python:
+# install:
+# - requirements: docs/requirements.txt
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,26 @@
+afew 3.1.0 (unreleased)
+=======================
+
+Python 3.6 support dropped
+
+ afew stopped supporting the older python version 3.6.
+
+Handle DMARC report with empty spf or dkim XML nodes
+
+DMARC Filter: allow to define subject regexp
+
+ Some DMARC report mail have a prefix before "Dmarc Report" in the subject
+ and where not checked by the plugin.
+ Afew now allows the user to define the suject regexp in the config file.
+
+Get notmuch database path using Database wrapper
+
+ This allows FolderNameFilter to work with a relative path in database.path of notmuch config file.
+
+HeaderMatchingFilter: do not convert user supplied tags
+
+ This prevents afew to lowercase the tags defined by the user, allowing to have non lowercase tags.
+
afew 3.0.0 (2020-03-10)
=======================
--- a/README.rst
+++ b/README.rst
@@ -2,7 +2,7 @@
afew
====
-|GithubTag| |CodeCov| |CI Status|
+|GithubTag| |CI Status|
About
-----
@@ -23,7 +23,7 @@
configurable rules that can contain arbitrary notmuch queries to match against
any searchable attributes.
-fyi: afew plays nicely with alot, a GUI for notmuch mail ;)
+fyi: afew plays nicely with alot, a TUI for notmuch mail ;)
* https://github.com/pazz/alot
@@ -32,9 +32,9 @@
IRC
---
-Feel free to ask your questions and discuss usage in the `#afewmail IRC Channel`_ on freenode.
+Feel free to ask your questions and discuss usage in the `#afewmail IRC Channel`_ on Libera.Chat.
-.. _#afewmail IRC Channel: http://webchat.freenode.net/?channels=#afewmail
+.. _#afewmail IRC Channel: http://web.libera.chat/?channels=#afewmail
Features
@@ -51,7 +51,6 @@
* can move mails based on arbitrary notmuch queries, so your sorting
may show on your traditional mail client (well, almost ;))
* has a ``--dry-run`` mode for safe testing
-* works with python 3.6+
@@ -69,7 +68,5 @@
.. |GithubTag| image:: https://img.shields.io/github/tag/afewmail/afew.svg
:target: https://github.com/afewmail/afew/releases
-.. |CodeCov| image:: https://codecov.io/gh/afewmail/afew/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/afewmail/afew
.. |CI Status| image:: https://github.com/afewmail/afew/workflows/CI/badge.svg
:target: https://github.com/afewmail/afew/actions
--- a/afew/Database.py
+++ b/afew/Database.py
@@ -97,7 +97,7 @@
def get_messages(self, query, full_thread=False):
"""
- Get all messages mathing the given query.
+ Get all messages matching the given query.
:param query: the query to execute using :func:`Database.do_query`
:type query: str
@@ -126,7 +126,7 @@
# TODO: bindings are *very* unpythonic here... iterator *or* None
# is a nono
replies = message.get_replies()
- if replies != None:
+ if replies is not None:
for message in replies:
# TODO: yield from
for message in self.walk_replies(message):
--- a/afew/MailMover.py
+++ b/afew/MailMover.py
@@ -80,7 +80,7 @@
shutil.copy2(fname, self.get_new_name(fname, destination))
to_delete_fnames.append(fname)
except shutil.SameFileError:
- logging.warn("trying to move '{}' onto itself".format(fname))
+ logging.warning("trying to move '{}' onto itself".format(fname))
continue
except shutil.Error as e:
# this is ugly, but shutil does not provide more
--- a/afew/NotmuchSettings.py
+++ b/afew/NotmuchSettings.py
@@ -9,14 +9,15 @@
def read_notmuch_settings(path=None):
- if path == None:
+ if path is None:
path = os.environ.get('NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config'))
with open(path) as fp:
notmuch_settings.read_file(fp)
-def write_notmuch_settings(path = None):
- if path == None:
+
+def write_notmuch_settings(path=None):
+ if path is None:
path = os.environ.get('NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config'))
with open(path, 'w+') as fp:
--- a/afew/configparser.py
+++ b/afew/configparser.py
@@ -17,7 +17,9 @@
return filter(None, result)
-class ConfigParser(configparser.ConfigParser, GetListMixIn): pass
+class ConfigParser(configparser.ConfigParser, GetListMixIn):
+ pass
-class RawConfigParser(configparser.RawConfigParser, GetListMixIn): pass
+class RawConfigParser(configparser.RawConfigParser, GetListMixIn):
+ pass
--- a/afew/files.py
+++ b/afew/files.py
@@ -8,13 +8,14 @@
import platform
import queue
import threading
+import notmuch
+import pyinotify
+import ctypes
+import contextlib
if platform.system() != 'Linux':
raise ImportError('Unsupported platform: {!r}'.format(platform.system()))
-import notmuch
-import pyinotify
-
class EventHandler(pyinotify.ProcessEvent):
def __init__(self, options, database):
@@ -22,7 +23,7 @@
self.database = database
super().__init__()
- ignore_re = re.compile('(/xapian/.*(base.|tmp)$)|(\.lock$)|(/dovecot)')
+ ignore_re = re.compile(r'(/xapian/.*(base.|tmp)$)|(\.lock$)|(/dovecot)')
def process_IN_DELETE(self, event):
if self.ignore_re.search(event.pathname):
@@ -45,17 +46,17 @@
filter_.run('id:"{}"'.format(message.get_message_id()))
filter_.commit(self.options.dry_run)
except Exception as e:
- logging.warn('Error processing mail with filter {!r}: {}'.format(filter_.message, e))
+ logging.warning('Error processing mail with filter {!r}: {}'.format(filter_.message, e))
try:
self.database.add_message(event.pathname,
sync_maildir_flags=True,
new_mail_handler=new_mail)
except notmuch.FileError as e:
- logging.warn('Error opening mail file: {}'.format(e))
+ logging.warning('Error opening mail file: {}'.format(e))
return
except notmuch.FileNotEmailError as e:
- logging.warn('File does not look like an email: {}'.format(e))
+ logging.warning('File does not look like an email: {}'.format(e))
return
else:
if src_pathname:
@@ -67,9 +68,9 @@
def watch_for_new_files(options, database, paths, daemonize=False):
wm = pyinotify.WatchManager()
mask = (
- pyinotify.IN_DELETE |
- pyinotify.IN_MOVED_FROM |
- pyinotify.IN_MOVED_TO)
+ pyinotify.IN_DELETE |
+ pyinotify.IN_MOVED_FROM |
+ pyinotify.IN_MOVED_TO)
handler = EventHandler(options, database)
notifier = pyinotify.Notifier(wm, handler)
@@ -83,9 +84,6 @@
notifier.loop()
-import ctypes
-import contextlib
-
try:
libc = ctypes.CDLL(ctypes.util.find_library("c"))
except ImportError as e:
@@ -171,7 +169,7 @@
if child not in blacklist):
try:
stat_result = os.stat(child_path)
- except:
+ except Exception:
continue
if stat_result.st_mode & stat.S_IFDIR:
@@ -193,7 +191,7 @@
while True:
result = results.get()
- if result != None:
+ if result is not None:
yield result
else:
break
--- a/afew/filters/DMARCReportInspectionFilter.py
+++ b/afew/filters/DMARCReportInspectionFilter.py
@@ -81,6 +81,8 @@
:param node: XML node holding status as text.
:returns: Whether the status is reported as "failed".
"""
+ if not node or not node.text:
+ return True
return (node.text.strip() not in ['pass', 'none'])
@@ -118,17 +120,28 @@
class DMARCReportInspectionFilter(Filter):
"""
Inspect DMARC reports for DKIM and SPF status.
+
+ Config:
+
+ [DMARCReportInspectionFilter]
+ dkim_ok_tag = "dmarc/dkim-ok"
+ dkim_fail_tag = "dmarc/dkim-fail"
+ spf_ok_tag = "dmarc/spf-ok"
+ spf_fail_tag = "dmarc/spf-fail"
+ subject_regexp = "^report domain:"
+
"""
def __init__(self, # pylint: disable=too-many-arguments
database,
dkim_ok_tag='dmarc/dkim-ok',
dkim_fail_tag='dmarc/dkim-fail',
spf_ok_tag='dmarc/spf-ok',
- spf_fail_tag='dmarc/spf-fail'):
+ spf_fail_tag='dmarc/spf-fail',
+ subject_regexp=r'^report domain:'):
super().__init__(database)
self.dkim_tag = {True: dkim_ok_tag, False: dkim_fail_tag}
self.spf_tag = {True: spf_ok_tag, False: spf_fail_tag}
- self.dmarc_subject = re.compile(r'^report domain:',
+ self.dmarc_subject = re.compile(subject_regexp,
flags=re.IGNORECASE)
self.log = logging.getLogger('{}.{}'.format(
self.__module__, self.__class__.__name__))
--- 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 @@
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)
--- 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 @@
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:
+ tagdict = {k: v.lower() for k, v in match.groupdict().items()}
+ sub = (lambda tag: tag.format(**tagdict))
+ self.remove_tags(message, *map(sub, self._tags_to_remove))
+ self.add_tags(message, *map(sub, self._tags_to_add))
+ except NullPointerError:
+ pass
--- a/afew/filters/SentMailsFilter.py
+++ b/afew/filters/SentMailsFilter.py
@@ -21,11 +21,11 @@
my_addresses.add(other_email)
self.query = (
- '(' +
- ' OR '.join('from:"%s"' % address for address in my_addresses)
- + ') AND NOT (' +
- ' OR '.join('to:"%s"' % address for address in my_addresses)
- + ')'
+ '(' +
+ ' OR '.join('from:"%s"' % address for address in my_addresses) +
+ ') AND NOT (' +
+ ' OR '.join('to:"%s"' % address for address in my_addresses) +
+ ')'
)
self.sent_tag = sent_tag
@@ -58,7 +58,7 @@
return email_to_tags
def __get_bare_email(self, email):
- if not '<' in email:
+ if '<' not in email:
return email
else:
match = self._bare_email_re.search(email)
--- /dev/null
+++ b/afew/tests/test_headermatchingfilter.py
@@ -0,0 +1,84 @@
+"""Test suite for DKIMValidityFilter.
+"""
+import unittest
+from email.utils import make_msgid
+from unittest import mock
+
+from afew.Database import Database
+from afew.filters.HeaderMatchingFilter import HeaderMatchingFilter
+
+from notmuch.errors import NullPointerError
+
+
+class _AddTags: # pylint: disable=too-few-public-methods
+ """Mock for `add_tags` method of base filter. We need to easily collect
+ tags added by filter for test assertion.
+ """
+ def __init__(self, tags):
+ self._tags = tags
+
+ def __call__(self, message, *tags):
+ self._tags.update(tags)
+
+
+def _make_header_matching_filter():
+ """Make `HeaderMatchingFilter` with mocked `HeaderMatchingFilter.add_tags`
+ method, so in tests we can easily check what tags were added by filter
+ without fiddling with db.
+ """
+ tags = set()
+ add_tags = _AddTags(tags)
+ header_filter = HeaderMatchingFilter(Database(), header="X-test", pattern="")
+ header_filter.add_tags = add_tags
+ return header_filter, tags
+
+
+def _make_message(should_fail):
+ """Make mock email Message.
+
+ Mocked methods:
+
+ - `get_header()` returns non-empty string. When testing with mocked
+ function for verifying DKIM signature, DKIM signature doesn't matter as
+ long as it's non-empty string.
+
+ - `get_filenames()` returns list of non-empty string. When testing with
+ mocked file open, it must just be non-empty string.
+
+ - `get_message_id()` returns some generated message ID.
+ """
+ message = mock.Mock()
+ if should_fail:
+ message.get_header.side_effect = NullPointerError
+ else:
+ message.get_header.return_value = 'header'
+ message.get_filenames.return_value = ['a']
+ message.get_tags.return_value = ['a']
+ message.get_message_id.return_value = make_msgid()
+ return message
+
+
+class TestHeaderMatchingFilter(unittest.TestCase):
+ """Test suite for `HeaderMatchingFilter`.
+ """
+ @mock.patch('afew.filters.HeaderMatchingFilter.open',
+ mock.mock_open(read_data=b''))
+ def test_header_exists(self):
+ """Test message with header that exists.
+ """
+ header_filter, tags = _make_header_matching_filter()
+ message = _make_message(False)
+ header_filter.handle_message(message)
+
+ self.assertSetEqual(tags, set())
+
+ @mock.patch('afew.filters.HeaderMatchingFilter.open',
+ mock.mock_open(read_data=b''))
+ def test_header_doesnt_exist(self):
+ """Test message with header that exists.
+ """
+ header_filter, tags = _make_header_matching_filter()
+ message = _make_message(True)
+ header_filter.handle_message(message)
+
+ self.assertSetEqual(tags, set())
--- a/afew/tests/test_mailmover.py
+++ b/afew/tests/test_mailmover.py
@@ -4,7 +4,6 @@
from email.utils import make_msgid
from freezegun import freeze_time
import mailbox
-import notmuch
import os
import shutil
import tempfile
@@ -13,6 +12,7 @@
from afew.Database import Database
from afew.NotmuchSettings import notmuch_settings, write_notmuch_settings
+
def create_mail(msg, maildir, notmuch_db, tags, old=False):
email_message = email.message.EmailMessage()
# freezegun doesn't handle time zones properly when generating UNIX
@@ -83,11 +83,9 @@
},
}
-
def tearDown(self):
shutil.rmtree(self.test_dir)
-
@staticmethod
def get_folder_content(db, folder):
return {
@@ -95,7 +93,6 @@
for msg in db.do_query('folder:{}'.format(folder)).search_messages()
}
-
def test_all_rule_cases(self):
from afew import MailMover
@@ -132,7 +129,6 @@
self.assertEqual(expect_archive, self.get_folder_content(db, '.archive'))
self.assertEqual(expect_spam, self.get_folder_content(db, '.spam'))
-
def test_max_age(self):
from afew import MailMover
--- a/afew/tests/test_utils.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-import unittest
-
-from afew import utils
-
-
-class TestUtils(unittest.TestCase):
- pass
-
-
-if __name__ == '__main__':
- unittest.main()
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -12,7 +12,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
from pkg_resources import get_distribution
# If extensions (or modules to document with autodoc) are in another directory,
@@ -42,7 +43,7 @@
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -79,37 +80,37 @@
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-#language = None
+# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
-#today = ''
+# today = ''
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
+# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
@@ -121,26 +122,26 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-#html_theme_options = {}
+# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-#html_title = None
+# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = None
+# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-#html_favicon = None
+# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -149,44 +150,44 @@
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
# If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
# If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'afewdoc'
@@ -195,10 +196,10 @@
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
+# latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
+# latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
@@ -209,26 +210,26 @@
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-#latex_logo = None
+# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
# If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
# If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
+# latex_preamble = ''
# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
# If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
--- a/docs/filters.rst
+++ b/docs/filters.rst
@@ -26,7 +26,7 @@
DKIMValidityFilter
------------------
-This filter verifies DKIM signatures of E-Mails with DKIM header, and adds `dkin-ok` or `dkin-fail` tags.
+This filter verifies DKIM signatures of E-Mails with DKIM header, and adds `dkim-ok` or `dkim-fail` tags.
DMARCReportInspectionFilter
---------------------------
@@ -145,7 +145,7 @@
[HeaderMatchingFilter.3]
header = X-Redmine-Project
- pattern = (?P<project>.*)
+ pattern = (?P<project>.+)
tags = +redmine;+{project}
SpamFilter and ListMailsFilter are implemented using HeaderMatchingFilter, and are
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,8 @@
yield 'chardet'
yield 'dkimpy'
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.rst'), encoding='utf-8') as f:
+ long_description = f.read()
setup(
name='afew',
@@ -19,6 +21,8 @@
description="An initial tagging script for notmuch mail",
url="https://github.com/afewmail/afew",
license="ISC",
+ long_description=long_description,
+ long_description_content_type="text/x-rst",
setup_requires=['setuptools_scm'],
packages=find_packages(),
test_suite='afew.tests',
|