Commit graph

439 commits

Author SHA1 Message Date
Floris Bruynooghe
776a54a0e4 Support aborting the atomic context
Since it is possible to use an atomic context to abort a number of
changes support this usage.  Because the only way to actually abort
the transaction is to close the database this must also do so.

Amended by db: Note the limitation requiring close is a limitation of
the underlying notmuch API, which should be fixed in a future notmuch
release.
2020-06-16 08:17:39 -03:00
Floris Bruynooghe
2d895a0119 Make messages returned by Thread objects owned
This reverses the logic of StandaloneMessage to instead create a
OwnedMessage.  Only the Thread class allows retrieving messages more
then once so it can explicitly create such messages.

The added test fails with SIGABRT without the fix for the message
re-use in threads being present.
2020-06-16 08:02:02 -03:00
Anton Khirnov
1317579079 python/notmuch2: do not destroy messages owned by a query
Any messages retrieved from a query - either directly via
search_messages() or indirectly via thread objects - are owned by that
query. Retrieving the same message (i.e. corresponding to the same
message ID / database object) several times will always yield the same
C object.

The caller is allowed to destroy message objects owned by a query before
the query itself - which can save memory for long-lived queries.
However, that message must then never be retrieved again from that
query.

The python-notmuch2 bindings will currently destroy every message object
in Message._destroy(), which will lead to an invalid free if the same
message is then retrieved again. E.g. the following python program leads
to libtalloc abort()ing:

import notmuch2
db   = notmuch2.Database(mode = notmuch2.Database.MODE.READ_ONLY)
t    = next(db.threads('*'))
msgs = list(zip(t.toplevel(), t.toplevel()))
msgs = list(zip(t.toplevel(), t.toplevel()))

Fix this issue by creating a subclass of Message, which is used for
"standalone" message which have to be freed by the caller. Message class
is then used only for messages descended from a query, which do not need
to be freed by the caller.
2020-06-16 08:02:02 -03:00
Floris Bruynooghe
1bca41698a python config access: fix style and KeyError bug
This fixes some minor style/pep8 things and adds tests for the new
config support.  Also fixes a bug where KeyError was never raised
on a missing key.
2020-06-15 21:50:03 -03:00
Anton Khirnov
5a58754841 python/notmuch2: add bindings for the database config strings 2020-06-15 21:50:03 -03:00
Floris Bruynooghe
b7e3a347ac Update tox.ini for python3.8 and fix pypy3.6
Python 3.8 has been released for a while now, make sure we keep
supporting it correctly.

PyPy 3.6 wasn not configured correctly.
2020-06-15 11:25:39 -03:00
Floris Bruynooghe
a00f3a1f7a Add missing set methods to tagsets
Even though we use collections.abc.Set which implements all these
methods under their operator names, the actual named variations of
these methods are shockingly missing.  So let's add them manually.
2020-06-15 07:14:11 -03:00
David Bremner
3bb546b30f version: bump to 0.30~rc1 2020-06-06 08:02:16 -03:00
David Bremner
dfd092e95d version: bump to 0.30~rc0 2020-06-01 21:00:04 -03:00
Daniel Kahn Gillmor
018ad3703b Drop deprecated/unused crypto.gpg_path
crypto.gpg_path was only used when we built against gmime versions
before 3.0.  Since we now depend on gmime 3.0.3 or later, it is
meaningless.

The removal of the field from the _notmuch_config struct would be an
ABI change if that struct were externally exposed, but it is not, so
it's safe to unilaterally remove it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2020-02-19 08:17:49 -04:00
Daniel Kahn Gillmor
93cc4b99df python/notmuch2: fix typo for "destroyed"
Another fix to the docstrings, this time for the English part of the
docstrings, not the Python class name.  No functional changes here.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-24 07:13:09 +09:00
Daniel Kahn Gillmor
34c5233894 python/notmuch2: fix typo for ObjectDestroyedError
There is no functional change here, just a fix to a typo in the
docstrings.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-24 07:12:51 +09:00
David Bremner
3185830e3a python-cffi: use shutil.which
I was supposed to amend the original patch that added this function,
but somehow I botched that. The original version runs, so make an
extra commit for the tidying.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
1e072204cd Move from _add_message to _index_file API
This moves away from the deprecated notmuch_database_add_message API
and instead uses the notmuch_database_index_file API.  This means
instroducing a class to manage the index options and bumping the
library version requirement to 5.1.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
e2df30f7a9 Rename package to notmuch2
This is based on a previous discussion on the list where this was more
or less seen as the least-bad option.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
a950aa2844 Show which notmuch command and version is being used
This add the notmuch version and absolute path of the binary used
in the pytest header.  This is nice when running the tests
interactively as you get confirmation you're testing the version you
thought you were testing.
2019-12-03 08:12:30 -04:00
David Bremner
46e9615621 build: optionally build python-cffi bindings
Put the build product (and tests) in a well known location so that we
can find them e.g. from the tests.
2019-12-03 08:12:30 -04:00
David Bremner
e8cb7c7f60 bindings/python-cffi: preserve environment for tests
We'll need this e.g. to pass PATH to the pytest tests

Based on the suggested approach in id:87d0eljggj.fsf@powell.devork.be
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
83c2d15898 Introduce CFFI-based python bindings
This introduces CFFI-based Python3-only bindings.
The bindings aim at:
- Better performance on pypy
- Easier to use Python-C interface
- More "pythonic"
  - The API should not allow invalid operations
  - Use native object protocol where possible
- Memory safety; whatever you do from python, it should not coredump.
2019-12-03 08:12:30 -04:00
David Bremner
dc2b5a031b notmuch release 0.29.3-1 for unstable (sid) [dgit]
[dgit distro=debian no-split --quilt=linear]
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAl3eb60ACgkQA0U5G1Wq
 FSE1Ug//Wxc7AYeHc9ErjBOkK/oQjagGOI6cKsovHfyHDRqVULsDfGt/at7wBuS2
 7V1sfU5zttoNmltmamkao4T+f/dH70D5UJxWXu1vM0QDnKz+1U4g5jTGV9sDbqwA
 34XtewzZ4508GjmmhhCHLkwQN1zplI1phGfhkwDCWrWc5er8Yat9EroHvgJ2GYcA
 fvMe13hODPC4/R5jPyKHKERyFrcj5oeZPOAV6pnaNKq1qeNgOpKm1usldl73rqe5
 ehrqF5ZgMr7wVjrnK/9wV4x4FTUKTgjweLzwQ3pWkYj3tzDx5KBBM47IrIKwoLh1
 /IS4PY9znohi/Nyl8IScmIeDAVj6PYITj0lqaDCL8x0vTkuZ5f8sFiJORZcmderk
 CylvJUahr/shdV1YolBsh1TfavP4eKIz77MkfO77uTyZACPIyZF0iHlV+me8ixIJ
 IDi2BJ0Sp+pky6/211iJtbf43CUnXATfr3COraLtT/xEKfENA63lvJRL4y+6ahmr
 BrGNfUZTvnY1+K9ym8dm3wfLe49TThMM+zbkY+2b25puO6u7cIFXgjBhhIwC4rdY
 bCd3RewBngge8NzvHw//k5+fd4s7b2BfA/6rLGWlEm4g6eik2IALtDU9Qm3L1twS
 RVr1yLoXICoJNLX7hZlgaF3iv+LzMrWkyKgjaLKiZ8HYnDwKXJg=
 =qUN/
 -----END PGP SIGNATURE-----

Merge tag 'debian/0.29.3-1'

notmuch release 0.29.3-1 for unstable (sid) [dgit]

[dgit distro=debian no-split --quilt=linear]
2019-11-27 08:45:43 -04:00
David Bremner
3efa2ad72c version: bump to 0.29.3 2019-11-27 08:20:54 -04:00
Jakub Wilk
bb843f63fc python: make some docstrings raw
Fixes:

    notmuch/message.py:57: DeprecationWarning: invalid escape sequence \s
    notmuch/query.py:155: DeprecationWarning: invalid escape sequence \.
    notmuch/messages.py:89: DeprecationWarning: invalid escape sequence \s

with Python >= 3.6.
2019-11-20 21:08:15 -04:00
David Bremner
449e77761e bump version 2019-10-19 07:21:53 -03:00
David Bremner
f325bd599c version: bump to 0.29.1 2019-06-11 20:11:45 -03:00
David Bremner
b4fe304344 version: bump to 0.29 2019-06-07 06:46:30 -03:00
David Bremner
fd97ef8a64 version: bump to 0.29~rc1 2019-06-03 08:08:00 -03:00
David Bremner
a425a010c9 version: bump to 0.29~rc0 2019-05-31 08:11:12 -03:00
David Bremner
6682b4e686 Merge tag 0.28.4
No functionality changes merged, since the bug in question was already
fixed on master.
2019-05-05 16:38:51 -03:00
David Bremner
1235902ed2 version: bump to 0.28.4 2019-05-05 08:06:07 -03:00
Doan Tran Cong Danh
816633e636 python: support relative path in default database
From notmuch 0.28, notmuch support relative database path in
notmuch-config(1), but python binding haven't taught this yet.

afew denied to work with a perfectly fine notmuch-config due to this.
2019-04-24 07:10:53 -03:00
hydrargyrum
7fe3062cf2 python: fix set_sort/add_tag_exclude restype/argtypes typos 2019-03-31 11:59:46 -03:00
David Bremner
71eaa19350 Merge branch 'release'
Changes from 0.28.3
2019-03-06 08:53:26 -04:00
David Bremner
1a4a1fe9c5 bump version to 0.28.3 2019-03-05 21:46:41 -04:00
Vincent A
872bd134e3 python: fix get_property error when property doesn't exist
In Python bindings, Message.get_property fails with an AttributeError when trying to fetch a property that doesn't exist.

From d712832ba982085975c27b23bb502af82e638b39 Mon Sep 17 00:00:00 2001
From: hydrargyrum <dev@indigo.re>
Date: Sun, 6 Jan 2019 16:08:55 +0100
Subject: [PATCH] python: fix get_property error when property doesn't exist
2019-02-21 07:17:18 -04:00
David Bremner
af0ff260cc bump version 2019-02-17 07:32:59 -04:00
Jani Nikula
0888639489 python: fix threads.__str__ automethod documentation
Indent the directive properly to attach it to Threads autoclass
documentation.

Fixes:

WARNING: don't know which module to import for autodocumenting
'__str__' (try placing a "module" or "currentmodule" directive in the
document, or giving an explicit module name)
2019-02-16 09:03:56 -04:00
Jani Nikula
528e5ba2c8 python: fix documentation title underline
Fix documentation build sphinx warning:

filesystem.rst:18: WARNING: Title underline too short.
2019-02-16 09:02:55 -04:00
Jani Nikula
510dc8c837 python: fix documentation build with python 3.7
The simplistic mocking in conf.py falls short on python 3.7. Just use
unittest.mock instead.

Fixes:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file
    execfile_(filename, namespace)
  File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "/path/to/notmuch/bindings/python/docs/source/conf.py", line 39, in <module>
    from notmuch import __VERSION__,__AUTHOR__
  File "/path/to/notmuch/bindings/python/notmuch/__init__.py", line 54, in <module>
    from .database import Database
  File "/path/to/notmuch/bindings/python/notmuch/database.py", line 25, in <module>
    from .globals import (
  File "/path/to/notmuch/bindings/python/notmuch/globals.py", line 48, in <module>
    class NotmuchDatabaseS(Structure):
TypeError: __mro_entries__ must return a tuple
2019-02-16 08:42:13 -04:00
David Bremner
4e746cf8f6 update version to 0.28.1 2019-02-01 08:06:38 -04:00
David Bremner
34e0782bf2 version: bump to 0.28 2018-10-12 20:18:14 -03:00
David Bremner
a5da8cd088 version: bump to 0.28~rc0 2018-10-03 20:17:54 -03:00
Vincent Breitmoser
5ae8ae13ba python: fix unchecked None access in get_property 2018-09-19 21:56:08 -03:00
David Bremner
b4303a1a72 version: bump to 0.27 2018-06-12 22:36:39 -03:00
David Bremner
98bdbae9f9 version: bump to 0.27~rc1 2018-05-31 08:17:12 -03:00
David Bremner
c6225a00f5 bump version to 0.27~rc0
Start the busywork for a new release
2018-05-26 09:11:49 -07:00
David Bremner
51f3a0786f bindings: clean extra file created by ruby extension build system
Noticed by dkg; this file seems to be created by building the debian
package, and perhaps by other distro package builds.
2018-05-14 22:18:18 -03:00
Thomas Schneider
b2e4778ea4 build: Allow user to specify ruby executable
This way, one can build for a different Ruby than $PATH/ruby
(e. g. different versions, or Ruby in other paths).

Signed-off-by: Thomas Schneider <qsx@chaotikum.eu>
2018-05-10 21:01:06 -03:00
Daniel Kahn Gillmor
c20a5eb805 move more http -> https
Correct URLs that have crept into the notmuch codebase with http://
when https:// is possible.

As part of this conversion, this changeset also indicates the current
preferred upstream URLs for both gmime and sup.  the new URLs are
https-enabled, the old ones are not.

This also fixes T310-emacs.sh, thanks to Bremner for catching it.
2018-05-03 20:59:20 -03:00
Ruben Pollan
5e05f00fe5 python: add bindings for notmuch_message_get_propert(y/ies)
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) yields key, value pairs
2018-05-02 20:16:11 -03:00
David Bremner
388edce0b7 Merge branch 'release'
minimal mset fix, for 0.26.2
2018-04-26 22:47:40 -03:00