Commit graph

60 commits

Author SHA1 Message Date
David Bremner
8b737af28b bindings/python-cffi: search for config by default
The previous (pre-0.34.2) constructor searched for a config file but
only if the database path was not specified, and only to retrieve
database.path. Neither of the available options (CONFIG.SEARCH or
CONFIG.NONE) matches this semantics exactly, but CONFIG.SEARCH causes
less breakage for people who relied on the old behaviour to set their
database.path [1]. Since it also seems like the friendlier option in
the long run, this commit switches to CONFIG.SEARCH as default.

This requires a certain amount of updating the pytest tests, but most
users will actually have a config file, unlike the test environment.

[1]: id:87fsqijx7u.fsf@metapensiero.it
2022-01-09 15:16:51 -04:00
David Bremner
9e7ea628e6 python-cffi: returned OwnedMessage objects from Message.replies
If we return regular Message objects, python will try to destroy them,
and the underlying notmuch object, causing e.g. the crash [1].

[1]: id:87sfu6utxg.fsf@tethera.net
2022-01-08 16:29:41 -04:00
David Bremner
05ee23ba42 version: bump to 0.34.2 2021-12-09 08:47:15 -04:00
Floris Bruynooghe
ca4e1d885b Fix error message when using notmuch_status_to_string
The python exception class was incorrectly loading the error message
which resulted in unprintable exception objects.
2021-12-05 08:53:39 -04:00
David Bremner
d7f9572413 python-cffi: switch to notmuch_database_{open,create}_with_config
Since release 0.32, libnotmuch provides searching for database and
configuration paths. This commit changes the python module notmuch2 to
use those facilities.

This fixes the bug reported in [1], along with a couple of the
deprecation warnings in the python bindings.

Database.default_path is deprecated, since it no longer faithfully
reflects what libnotmuch is doing, and it is also no longer used in
the bindings themselves.

This commit choose the default of config=CONFIG.EMPTY (equivalent to
passing "" to notmuch_database_open_with_config).  This makes the
change upward compatible API-wise (at least as far as the test suite
verifies), but changing the default to CONFIG.SEARCH would probably be
more convenient for bindings users.

[1]: id:87h7d4wp6b.fsf@tethera.net
2021-12-04 08:42:31 -04:00
David Bremner
4b361f4d35 python-cffi: fix typos in docstring for Database.default_path
These generate warnings from sphinx doc, which makes it harder to
debug documentation changes. They also corrupt the output.
2021-12-04 08:36:07 -04:00
David Bremner
0c2edc522b version: bump to 0.34.1 2021-10-31 08:11:25 -03:00
David Bremner
7b490b4b80 version: bump to 0.34 2021-10-20 10:42:18 -03:00
David Bremner
5ad946310d version: bump to 0.34~0
Start release process for 0.34.
2021-10-15 08:28:59 -03:00
David Bremner
3e2e724d53 notmuch 0.33.2 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFVoPUACgkQA0U5G1Wq
 FSGSzg//WY202qUibO6pgFMPvgpYCB5g9Bq2lSzEcJzc2ZqZIH/3WvFSUeHMrInb
 GmHzJ4Q1w00K/wyB8MLYILKJ5/Tikg+O63/YkZMjXx6CDwu9zyNdk3L7TuZjkiOB
 rRiCPlEO7vvzUKedyecpY07DpgCYku1R9eOk032aSZEdOVheXIUUwDcR/cSFhxjO
 9amPls9vjZXKOQjOH8dgbxyZX8JbcTECgwYoFCT1k88NrVXdcGc3ds/ZuJowf2S7
 rIOLCZVuJD0yPGtMUBMHr5bRJ4O6e4NsHLNOgELFid3WXmQ3TzrRBDuJX5rDaaOs
 +0aqFWS57lujZLF+dZbZAYqK9CnQxZct+Au8GJlvvHZUBnS2skTTK8zu4NuGmgh0
 wckeesSXImC/NxHP/HaRNvcmrOUPTWYr3SaNKAbAl6zSjkhgzYxMnTnAFev+7HAc
 TNa50iLfMYaM0lyzD5gzhZZKvk68wwi1bxxhNMmfOF94HTjKOvL1AWxPoQkYUNN8
 07yvxURcZHwng+ufIfr/XsTDleiqSkYRJFtkpyP6+ZoYrIj815qtqQ03lzJTcYRn
 wMv3ipMrLuYMeP8T3Pr0y8DEl2WVPRyybYbN+07SkQLULzmjBhivxn3abSRqOFKm
 zDn6XiY3BMhTOPaslVIxZdP/8k7fA7Ak5qTVkXLZCPMZiV36k0w=
 =mwj4
 -----END PGP SIGNATURE-----

Merge tag '0.33.2'

notmuch 0.33.2 release
2021-09-30 08:58:48 -03:00
David Bremner
3c60a25c6d version: bump to 0.33.2 2021-09-30 08:28:49 -03:00
David Bremner
7556bb7da2 notmuch 0.33.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmE7RAYACgkQA0U5G1Wq
 FSHDHA//Q5SJhT9fD/yi2QOI4zIHvF438WtAGIL+TnYIeY8lDmdYZaRjU9Ub4O3J
 eLxJMhNcOyY35nDEGOOVga33aS8lefI+q/Ozx5sNzSge9PRaha+hGAmY2UrkOm+z
 TQBjFsdnGyWdTmJbkC9VQsaQJWjeKUKM0J4eT/sWFrJfW9vHuGnzrEnpOTQu8xk1
 OWshsYc5AkMnnvUBv0JuCJ4z4HQkTHeMrMKwd+B0/SC4OxPQ/af6FaMkoKanH0Ej
 q661AaZW+WNupynS1nu/O99z5U4BJ1V7nz361degdINfaUh/vmcXgHN7jGeoFtj4
 rTjV/51Jy/5WCbYV+11a0+RMZOEoQZi4ZBai6E6WVHpztkDXXqxHyDnho+A4SYK9
 1G/Rs6lO9FYRLTvdYhJbLH4OZgglPWXFgWJJxGLY+5cM7d86g8LC2pbJGWZ5IbAW
 eB3LRFStaqsBqjx9noxt9BcdxmbEu4o7lCm6y+EdAD04X37MGvv+Mlwsz57EMG9c
 2NCntrc1BUUTb/7mCp6oZn0miPCmYFVLtTj0ZfLAdP89aLJVTn6a36uTv8NqcszR
 ZjBFqGxB9AMU0idTEHnHJ5acNj4bLPwDBPBGYmEWnky/Tn7ZT3XqEDVvOXY2HVwa
 0RkVsgMsUIqUXutXjUYlLcl4YgmgpTsRbVpMZJh0/R4N9spDyWU=
 =P0Xd
 -----END PGP SIGNATURE-----

Merge tag '0.33.1'

notmuch 0.33.1 release
2021-09-10 21:02:10 -03:00
David Bremner
c6524148fc version: bump to 0.33.1 2021-09-10 08:21:28 -03:00
David Bremner
9ae4188610 lib: add new status code for query syntax errors.
This will help provide more meaningful error messages without special
casing on the client side.
2021-09-04 17:07:19 -07:00
David Bremner
f90e8e6a5c version: bump to 0.33 2021-09-03 12:20:27 -07:00
David Bremner
0a50bd05f8 version: bump to 0.33~rc0 2021-08-26 08:25:36 -07:00
David Bremner
c8ef3a9443 version: bump to 0.32.3 2021-08-17 17:12:27 -07:00
David Bremner
636e03a9ca version: bump to 0.32.2 2021-06-25 09:02:54 -03:00
David Bremner
6d5531da0c version: bump to 0.32.1 2021-05-15 08:59:01 -03:00
David Bremner
ff5311b098 version: bump to 0.32 2021-05-02 07:00:15 -03:00
David Bremner
bc58b5ad0d version: bump to 0.32~rc2 2021-04-28 07:04:57 -03:00
David Bremner
07a8130483 version: bump to 0.32~rc1 2021-04-24 12:26:09 -03:00
David Bremner
2e6a40ea8c update version to 0.32~rc0 2021-04-24 08:45:54 -03:00
David Bremner
2e39ce6eb5 lib: add NOTMUCH_STATUS_NO_DATABASE
This will allow more precise return values from various open related functions.
2021-03-27 09:26:14 -03:00
David Bremner
4c79a2dabe notmuch 0.31.4 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmAuVjQACgkQA0U5G1Wq
 FSG6RA//bDdAtsG7QlywGONVX1FOSHxAgppDVRvSDXuluPmGgWvc2T80awbonfT5
 AHy9co41L9484QbOzd29d9Ttu5O39JdQbo+DCAJ6y2vm1M1dLCZw3HXaZGfxoUZo
 9L9Agxg/rYIEso7dAehOs3rGsia46aj2MDCVCUuA4DkVFhkbQ2QidIH+l3VPdYqm
 +1XmuJwyftO7hMifFd9W9ifO9wrBcK9WtJ23feufMhqfBsS0ItLysOhZQx+QdxSj
 7GuA6qX6V7XlIWpdohIOMKmT9tGHMDUo6Qk5m8aSc2XmKAybAXRc+qr0Kg8EpvBF
 1d9SqNptcXQL6rORJxluXR/aCuCb7m8YDgxFVSrFcp/M/twbpDC3WzjmAV+RZpDP
 GBKDH06IGaOMOj9GaYYWCe9loGROzOIT4y04Ckukit0AWpmdbaKnkAkPdrxrMWEu
 a5v5KkkMYT42q0PFU5bDjwvq+8Afmzt7oMO72zXz0mfuFNtFzZCUN/AG9LtHoRfk
 Q2ks/xBppmtCxWRAHVWc7f+Gk1OzI2PLVWnXIe9gxGimSpgT2QPUvZcxLHT/XWD5
 XRrrxtkPjKB1v6tWOFEMPI6WxE1iBzoC9AdG2h48ZP5drlLObcAxhAg5AvHJGJSr
 8D4iSa9cKjHD6qxDSXChzF6BF4aDNhF2Flq9Cs9tZb8nyt+Ix18=
 =mAE/
 -----END PGP SIGNATURE-----

Merge tag '0.31.4'

notmuch 0.31.4 release
2021-02-18 08:47:53 -04:00
David Bremner
2ab95d813c version: update to 0.31.4 2021-02-18 07:17:22 -04:00
David Bremner
ac67cd84ee lib: introduce notmuch_database_create_with_config
This takes a config path parameter, and can use that to decide the
new database location.
2021-02-06 19:48:34 -04:00
David Bremner
55f5e87096 lib: add NOTMUCH_STATUS_DATABASE_EXISTS
It is desirable to distinguish between attempting to create a database
that already exists, and more fatal errors like permission problems.
2021-02-06 19:46:46 -04:00
David Bremner
eea258c0c9 lib: add NOTMUCH_STATUS_NO_CONFIG
This will allow client code to provide more meaningful diagnostics. In
particular it will enable "notmuch new" to continue suggsting the user
run "notmuch setup" to create a config after "notmuch new" is
transitioned to the new  configuration framework.
2021-02-06 19:43:11 -04:00
David Bremner
baf1202fbc bindings/notmuch2: add missing crypto error status codes
These are needed so that the later codes line up numerically.
2021-02-06 19:37:50 -04:00
David Bremner
c7596d0e7d version: bump 0.31.3 2020-12-25 11:42:12 -04:00
Johannes Larsen
f01f6405c9 python/notmuch2: fix exclude tag handling
A typo in Database._create_query lost the exclude_tag names during the
string to utf-8 conversion.

Amended by DB: fixed patch format and updated commit message.
2020-12-25 11:25:25 -04:00
David Bremner
6003af14c4 version: bump to 0.31.2 2020-11-08 13:19:07 -04:00
David Bremner
b8a3ed175c update versions 2020-11-08 07:32:10 -04:00
Ralph Seichter
981d5a0168 Rename version to version.txt
Building Notmuch on macOS is known to cause problems because the Notmuch
distribution archive contains two files named "version". These names
clash with the <version> header as defined in C++20. Therefore, the
existing naming will likely become a problem on other platforms as well,
once compilers adopt the new standard.

Signed-off-by: Ralph Seichter <github@seichter.de>
Amended-by: db s/keyword/header/ in commit message.
2020-10-30 16:14:24 -03:00
David Bremner
008b8b0574 version: bump to 0.31 2020-09-05 21:26:36 -03:00
David Bremner
c8c0304d77 version: bump to 0.31~rc2 2020-08-29 09:32:36 -03:00
David Bremner
e6f95910b3 version: bump to 0.31~rc1 2020-08-17 21:02:30 -03:00
David Bremner
efb135bed1 version: bump to 0.31~rc0
Start the release process for 0.31
2020-08-16 11:06:13 -03:00
Jonas Bernoulli
6c84dee531 Fix typos 2020-08-09 21:14:36 -03:00
David Bremner
e56a207ce1 version: set to 0.30 2020-07-10 22:21:19 -03:00
David Bremner
038b3e7c30 version: bump to 0.30~rc3 2020-07-03 06:45:17 -03:00
David Bremner
3a42abb456 bindings/python-cffi: copy version file into bindings dir
Attempt to avoid breaking "pip install ."

As far as I can tell, we need to have a copy (not just a relative
symlink) of the version file.
2020-07-03 06:38:55 -03:00
Floris Bruynooghe
81057164cd python-cffi: read version from notmuch version file
This keeps it in sync with the main notmuch version which is less
confusing to users.
2020-06-19 07:01:13 -03:00
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