Commit graph

521 commits

Author SHA1 Message Date
Wael M. Nasreddine
0629afeb26 ruby: Add wrapper for notmuch_query_count_threads 2014-05-18 06:39:58 +09:00
David Bremner
b661b87801 version: bump to 0.18
debian changelog to be done seperately.
2014-05-06 16:24:17 +09:00
David Bremner
1f2bb88e92 version: bump for 0.18~rc1
Doing all of the needed version bumps in one commit, and do a
complete, if minimal debian changelog entry
2014-05-04 07:34:00 +09:00
David Bremner
d879c47ff1 python: bump version 2014-04-22 09:40:28 +09:00
Gaute Hope
5569344a7e ruby bindings message: docstring typo 2014-02-21 21:13:03 -04:00
David Bremner
ceef57b3d9 version: bump to 0.17 2013-12-30 20:34:23 -04:00
David Bremner
05b534209d version: bump to 0.17~rc4
Unfortunately release-checks.sh will whine a bit because it has not
caught up with the renaming of the version macros.
2013-12-28 18:40:05 -04:00
David Bremner
bb390f89a1 version: bump version
Roll (one last?) release candidate because of Austin's
LIBNOTMUCH_VERSION changes.

Atomically bump the manually (NEWS, debian/changelog) and
automatically (everywhere else) updated places version is mentioned.
2013-12-07 17:07:15 +08:00
David Bremner
6c9cd7d20c version: bump to 0.17~rc2 2013-11-28 21:00:52 -04:00
David Bremner
bd0c56b2bd version: bump to 0.17~rc1
Various other files are synched using "make update-versions".  NEWS
has to be hand edited.
2013-11-23 20:29:46 -04:00
David Bremner
80b25792b2 version: set new version and release date
These are manually set in version and NEWS, and propagate to the other files via
"make update-versions"
2013-07-28 11:28:03 -03:00
Tomi Ollila
acb079e357 Python bindings: CDLL("libnotmuch.3.dylib") on Darwin
Use os.uname() to check for 'Darwin' and load "libnotmuch.3.dylib"
instead of "libnotmuch.so.3" if that is the case.
2013-07-09 08:38:42 +02:00
David Bremner
5306b2b1e5 bindings/go: Start a .gitignore for go bindings.
In particular ignore downloaded source from github.com
2013-06-03 08:07:22 -03:00
David Bremner
9a1ab6c487 bindings/python: ignore build subdirectory.
Update .gitignore to make git status less noisy
2013-06-03 08:00:29 -03:00
Felipe Contreras
8c3d19313e ruby: use in-tree notmuch library
Currently it simply finds any library available, and if notmuch is
installed in the system, it would give priority to that library.

Let's implement our own helper functions to link directly to the local
library, and give priority to the local header file.

Also, add an option to properly check if there are missing symbols.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-05-23 08:15:20 -03:00
Felipe Contreras
ed9ef5dc5a ruby: fix missing symbol UINT2FIX()
It has never existed in Ruby (maybe JRuby). Fortunately the symbols are
loaded lazily, so nobody would notice unless they try
'query::count_messages'.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-05-23 08:03:58 -03:00
Austin Clements
45b9b55863 python: Add bindings for notmuch_thread_get_messages 2013-05-05 13:56:39 -03:00
Justus Winter
44fe1f2c16 go: use a different goconfig package
The notmuch-addrlookup utility uses a third party library to read the
notmuch configuration file. The previously used implementation at
"github.com/kless/goconfig" vanished, so this patch switches to the
implementation at "github.com/msbranco/goconfig". As the
implementations differ at the API level, the code is updated
accordingly.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2013-05-03 21:21:01 -03:00
David Bremner
16aa65ba25 Merge branch 'release'
add in NEWS from 0.15.2

Conflicts:
	NEWS
2013-02-18 20:33:48 -04:00
Austin Clements
c4f96d0931 ruby: Add bindings for notmuch_thread_get_messages 2013-02-18 20:23:40 -04:00
David Bremner
bcccc2e1fe bump versions to 0.15.2 2013-02-17 11:39:46 -04:00
David Bremner
7264732a79 Merge branch 'release'
Conflicts:
	NEWS

Inserted news from 0.15.1
2013-01-24 22:29:09 -04:00
David Bremner
d273ed6cf1 version: bump to 0.15.1
A simple bugfix release, no user visible changes
2013-01-24 07:11:27 -04:00
Justus Winter
c8cb2beda7 python: fix the creation of notmuch databases
Remove the superfluous mode argument given to notmuch_database_create
fixing the creation of notmuch databases using python code.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2013-01-23 18:12:04 +01:00
David Bremner
df9f50185c version: update to 0.15
Bump the version in-place in NEWS.
2013-01-18 21:27:57 -04:00
David Bremner
81866a82ad version: set version to 0.15~rc1
This is in some sense a rollback, but it makes all the automation
happier if the Debian and upstream versions match.
2013-01-16 23:23:00 -04:00
David Bremner
37be45767f version: bump to 0.15
"Atomically" update the python bindings and man page versions.
2013-01-07 21:38:20 -04:00
Justus Winter
db64b67bf8 python: remove now unused import of module sys
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-12-21 14:23:54 +01:00
Justus Winter
0687e2ae23 python: remove functions that have been marked as deprecated in 0.14
Removes Message.{format,print}_messages.

This code adds functionality at the python level that is unlikely to
be useful for anyone. Furthermore the python bindings strive to be a
thin wrapper around libnotmuch. The code has been marked as deprecated
in 0.14 and is now removed.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-12-21 10:56:06 +01:00
Justus Winter
8728340644 python: remove Database.db_p
The function has been marked as deprecated in 0.14 and is now removed.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-12-21 10:56:06 +01:00
David Bremner
6442a47361 version: propagate version changes
These are the result of running "make update-versions"
2012-08-21 10:43:49 +02:00
Tomi Ollila
d796dad4ed ruby: extern linkage portability improvement
Some C compilers are stricter when it comes to (tentative) definition
of a variable -- in those compilers introducing variable without 'extern'
keyword always allocates new 'storage' to the variable and linking all
these modules fails due to duplicate symbols.

This is reimplementation of Charlie Allom's patch:
id:"1336481467-66356-1-git-send-email-charlie@mediasp.com",
written originally by Ali Polatel. This version has
more accurate commit message.
2012-06-29 22:24:17 -03:00
David Bremner
5973881b77 notmuch 0.13.2 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iJwEAAECAAYFAk/LdWUACgkQTiiN/0Um85mL8AP/UosXwRabmZT8WjsJ/tPT0N2s
 zIBguJM7jNwnODZ1kFuS5AjxslbsA3SVubWI1rB5CZwINoF0+f+zc1pHHjAjy61R
 XAbSIQsI+2XvnfvDFnLYzyZb6xUX/Q1vczoJ4o2ngLMW5+kkERWYN+T6Ee291c/D
 MTPvV4fuHxvnFAX+Oig=
 =DiJS
 -----END PGP SIGNATURE-----

Merge tag '0.13.2'

notmuch 0.13.2 release
2012-06-03 11:38:08 -03:00
David Bremner
9d5f73db7a version: update to 0.13.2 2012-06-02 18:10:55 -03:00
David Bremner
d99f15d7ee Merge branch 'release' 2012-05-29 09:07:31 -03:00
Felipe Contreras
5946aba519 Revert "ruby: Add workarounds to use in-tree build not the installed one"
This reverts commit 82b73ffd73.

Only leave the copyright changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
(cherry picked from commit 35cb1c95cc)
2012-05-28 10:21:37 -03:00
David Bremner
df96c93239 version: bump to 0.13.1 2012-05-25 21:17:54 -03:00
Felipe Contreras
35cb1c95cc Revert "ruby: Add workarounds to use in-tree build not the installed one"
This reverts commit 82b73ffd73.

Only leave the copyright changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2012-05-25 15:11:31 +02:00
David Bremner
6d44c5af65 Merge branch 'release'
merge 0.13.1 bugfix patches back to master, fixes for emacs reply and
spurious directory document creation.
2012-05-23 22:48:16 -03:00
Austin Clements
54508eb78d python: Remove find_message_by_filename workaround
Now that notmuch_database_find_message_by_filename works on read-only
databases, remove the workaround that disabled it on read-write
databases.

This also adds a regression test for find_message_by_filename.
2012-05-23 22:32:02 -03:00
Austin Clements
f1f1e39639 python: Update Database.get_directory documentation
notmuch_database_get_directory no longer returns an error for
read-only databases, so remove ReadOnlyDatabaseError from the list of
get_directory exceptions.
2012-05-23 22:31:36 -03:00
Justus Winter
8c123d0da6 python: deprecate Messages.{format,print}_messages
This code adds functionality at the python level that is unlikely to
be useful for anyone. Furthermore the python bindings strive to be a
thin wrapper around libnotmuch, so this code will be removed in
notmuch 0.15.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 19:10:28 +02:00
Justus Winter
892bb1ee6d python: deprecate Database.db_p
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 19:09:25 +02:00
Justus Winter
8f667be2ac python: fix Message.get_header
8dc8495010 introduced a bug, if the
requested header is not set the underlying notmuch function returns an
empty string that also made the expression true resulting in an
exception being raised. Partly revert the commit to fix this
issue. Testing for equality with None is correct in this case since
the restype of the function Message._get_header is c_char_p so NULL
pointers are in fact converted to None in this case.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 18:23:11 +02:00
Justus Winter
8e3faa7f18 python: add a file abstracting away differences between python 2 and 3
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 18:23:11 +02:00
Justus Winter
643719dfce python: remove the "notmuch binary" section from the docs
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 17:47:49 +02:00
Justus Winter
8dc8495010 python: Fix the remaining broken NULL pointer tests
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 17:15:49 +02:00
Justus Winter
05c3e83bd2 python: use relative imports
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 16:58:53 +02:00
Justus Winter
5bc5471c54 python: remove unused import of the json module
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-17 16:55:29 +02:00
Justus Winter
b9d1045474 python: remove format_message_as_{json,text} from the sphinx docs
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-16 16:57:45 +02:00
Justus Winter
cd8fe01013 python: remove functions that have been marked as deprecated in 0.13
Removes Message.format_message_{internal,as_json,as_text}.

This code adds functionality at the python level that is unlikely to
be useful for anyone. Furthermore the python bindings strive to be a
thin wrapper around libnotmuch. The code has been marked as deprecated
in 0.13 and is now removed.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-16 16:55:15 +02:00
Justus Winter
eab15cc707 python: remove notmuch.py
Removes notmuch.py. If someone wants to step up and work on this it
can always be restored using the version control system.

notmuch.py was meant to be a python implementation of the notmuch
utility. It was never finished and hasn't been updated to changes in
the API and bindings and its features and interface haven't been kept
in sync with the notmuch utility.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-16 16:55:15 +02:00
David Bremner
3fb08bc125 version: bump to 0.13 2012-05-15 18:18:45 -03:00
Austin Clements
bc4000a952 ruby: Update for changes to notmuch_database_get_directory 2012-05-15 08:59:05 -03:00
Austin Clements
ed4f73a080 python: Update for changes to notmuch_database_get_directory
notmuch_database_get_directory now returns
NOTMUCH_STATUS_READ_ONLY_DATABASE on its own (rather than crashing) so
the workaround in Database.get_directory is no longer necessary.
2012-05-15 08:58:47 -03:00
Austin Clements
cdaf253c99 go: Update for changes to notmuch_database_get_directory 2012-05-15 08:58:36 -03:00
Justus Winter
1952889353 go: format the souce code using gofmt
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:36:43 -03:00
Justus Winter
3113731713 go: update the build system
The new "go" utility does not require any Makefiles to compile go
packages and programs. Remove the old Makefiles and replace the top
level Makefile with one defining some convenience targets for
compiling the notmuch bindings and the notmuch-addrlookup utility.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:36:30 -03:00
Justus Winter
9bf6eec1a5 go: update the addrlookup utility to go 1
Use the new built in error type that replaces os.Error, adapt the code
to the fact that strings.Split has just two arguments now.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:35:50 -03:00
Justus Winter
3760a79b3f go: set LDFLAGS to -lnotmuch in the packages source file
Set the LDFLAGS to -lnotmuch so the resulting go package will be
linked with libnotmuch.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:35:38 -03:00
Justus Winter
97565b77cd go: reorganize the go bindings
go 1 introduced the "go" program that simplifies building of libraries
and programs. This patch reorganizes the go code so it can be compiled
using the new utility, it does not change any files.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:32:44 -03:00
Justus Winter
f83a5c6241 go: define the constant STATUS_UNBALANCED_ATOMIC
Add the constant STATUS_UNBALANCED_ATOMIC to the list of notmuch
status codes.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:28:33 -03:00
Justus Winter
0af7295faf go: fix the notmuch status constants
Formerly all the constants were set to zero since in golang constants
are set to the previous value if no new value is specified. Use the
iota operator that is incremented after each use to fix this issue.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:28:21 -03:00
Justus Winter
9f5478637c go: update notmuch-addrlookup to the new API
notmuch.OpenDatabase now returns a status indicating success or
failure. Use this information to inform the user of any failures.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-05-11 08:28:06 -03:00
David Bremner
a4b10675bf bump version to 0.13~rc1 2012-05-08 14:49:08 -03:00
Ali Polatel
a8e010962f ruby: Add wrapper for notmuch_query_set_omit_excluded() 2012-05-08 10:34:50 -03:00
Ali Polatel
82b73ffd73 ruby: Add workarounds to use in-tree build not the installed one
- Make mkmf use the notmuch.h under ../../lib
- Use libnotmuch.a instead of linking to the installed libnotmuch.so
2012-05-08 10:34:33 -03:00
Ali Polatel
92680f12eb ruby: Add wrapper for notmuch_query_add_tag_exclude 2012-05-08 10:32:56 -03:00
Ali Polatel
d0000daab3 ruby: Add wrapper for notmuch_query_count_messages 2012-05-08 10:32:45 -03:00
Austin Clements
7bf5be75ae lib: Bump SO version from 2.0.0 to 3.0.0
We've changed the APIs of notmuch_database_open,
notmuch_database_create, and notmuch_database_close.

Amended by db: also bump string in bindings/python/notmuch/globals.py
2012-05-05 20:06:09 -03:00
Austin Clements
9721343e5b ruby: Update Ruby bindings for new notmuch_database_{open, create} signatures 2012-05-05 10:14:47 -03:00
Austin Clements
0a357fe410 python: Update Python bindings for new notmuch_database_{open, create} signatures 2012-05-05 10:13:57 -03:00
Austin Clements
2e346b9e2a go: Update Go bindings for new notmuch_database_{open, create} signatures
This requires changing the return types of NewDatabase and
OpenDatabase to follow the standard Go convention for returning
errors.
2012-05-05 10:13:17 -03:00
Austin Clements
ce53850290 go: Update to the current notmuch_database_find_message API
The signature of notmuch_database_find_message was changed in 02a30767
to report errors and the Go bindings were never updated.  This brings
the Go bindings in sync with that change and at least makes them
compile with Go r60.3, the last release before Go 1.
2012-05-04 08:49:43 -03:00
Justus Winter
fcfb619b44 python: remove a note stating wrong things about the memory management
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 19:51:16 +02:00
Justus Winter
ca1e232e5f python: document the Database.close function
Put a prominent warning into the docstring of Database.close, make the
function show up in the sphinx doc and refer to the warning in the
paragraph mentioning the context manager protocol.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 19:48:45 +02:00
Justus Winter
e9bcbe7e70 python: deprecate code formatting messages as text and json
This code adds functionality at the python level that is unlikely to
be useful for anyone. Furthermore the python bindings strive to be a
thin wrapper around libnotmuch, so this code will be removed in
notmuch 0.14.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 19:27:36 +02:00
Justus Winter
7f74a400d1 python: cleanup the __nonzero__ implementations
Cleanup the code, reword the docstring and use the same implementation
in the Threads, Tags and Messages classes.

__nonzero__ implements truth value testing. If __nonzero__ is not
implemented, the python runtime would fall back to `len(..) > 0` thus
exhausting the iterator.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 19:25:16 +02:00
Justus Winter
162687a99e python: fix NULL pointer tests
Fix the NULL pointer tests in the destructors of all classes and
Database.create.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 19:24:34 +02:00
Justus Winter
09fdf2b283 python: update the docstrings of Filenames.{__len__,__unicode}
Formerly the documentation was overly verbose. Reword the comment and
use the same for both functions.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 18:43:02 +02:00
Justus Winter
0803603cdd python: update the docstring of class Filenames
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 18:39:06 +02:00
Justus Winter
60e512d84f python: fix the documentation
Remove the reference to Filenames.as_generator in the sphinx
documentation.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 18:32:32 +02:00
Justus Winter
bbc38c5c11 python: fix Message.get_filenames
Do not to use the removed function Filenames.as_iterator.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 18:27:15 +02:00
Justus Winter
e74b1f807b python: remove the deprecated function Filenames.as_generator
Remove the function Filenames.as_generator that has been marked as
deprecated in 0.12.

The class Filenames implements the iterator protocol so you can
directly iterate over such objects instead.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-30 18:13:31 +02:00
Justus Winter
1f08664a6b python: strip superfluous single quote from copyright notices
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:33:06 +02:00
Justus Winter
43ee25f7a9 python: add copyright and licensing information to setup.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:30:38 +02:00
Justus Winter
51e8e68649 python: stylistic and pep8 fixes in setup.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:28:50 +02:00
Justus Winter
3ff39766d4 python: update the long description in setup.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:26:36 +02:00
Justus Winter
99b4ae1a88 python: fix the test asserting that reading the version succeeded
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:21:32 +02:00
Justus Winter
61cf962df8 python: simplify a path expression in setup.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:18:52 +02:00
Justus Winter
7190b0dbc2 python: Remove unused import from setup.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-29 16:15:41 +02:00
Justus Winter
7bfc4bf501 python: wrap and use notmuch_database_destroy as destructor
Adapt the python bindings to the notmuch_database_close split.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:31:12 -03:00
Justus Winter
288feb7cdf ruby: Use notmuch_database_destroy instead of notmuch_database_close
Adapt the ruby bindings to the notmuch_database_close split.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:30:02 -03:00
Justus Winter
22f73735c5 go: Use notmuch_database_destroy instead of notmuch_database_close
Adapt the go bindings to the notmuch_database_close split.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:29:38 -03:00
David Bremner
c302bfa2f6 update version to 0.12
There may be a few NEWS changes after this, but no code (hopefully).
2012-03-19 22:28:17 -03:00
David Bremner
d71cb5e45b bump version to 0.12~rc2 2012-03-18 08:07:00 -03:00
Justus Winter
3a95f3fbc1 python: fix signature of two wrapped libnotmuch functions
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-03-18 07:59:36 -03:00
David Bremner
916aefc2de bump version to 0.12~rc1
As usual, only `version' is edited by hand. The rest of the changes I
blame on the machine.
2012-03-01 07:47:21 -04:00
Justus Winter
d50171d1cc python: split the documentation
Move each classes documentation into its own file and thus into its
own page in the generated documentation.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-24 01:55:33 +01:00
Justus Winter
594dbb6243 python: move the notmuch module section to notes.rst
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-24 01:30:04 +01:00
Justus Winter
8dfbba05fa python: move the usage example to quickstart.rst
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-24 01:18:54 +01:00
Justus Winter
fb52083bf7 python: strip module prefix in the sphinx documentation
Remove the notmuch prefix from classes in the documentation. This
change makes the table of contents look much nicer.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-24 00:38:47 +01:00
Justus Winter
90fb4e8334 python: mention the exception class refactoring in the docs
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-23 00:14:59 +01:00
Justus Winter
a7561cc20b python: move the exception classes into error.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-23 00:11:22 +01:00
Justus Winter
df0e1cf788 python: rename filename.py into filenames.py
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 22:44:35 +01:00
Justus Winter
76a2db3d7b python: move Threads class into its own file
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 22:39:52 +01:00
Justus Winter
69f077898a python: move Messages class into its own file
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 22:34:40 +01:00
Justus Winter
ba95980cf1 python: refactor the python bindings
Move the Directory class into its own file, merge the two Filenames
classes into one, deprecate Filenames.as_iterator, update the
documentation accordingly.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 22:06:45 +01:00
Justus Winter
1736488ecf python: work around libnotmuch calling exit(3) in Database.find_message_by_filename
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 21:14:35 +01:00
Justus Winter
05cdb3d7b7 python: improve the docstring of Database.find_message_by_filename
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 21:14:35 +01:00
Justus Winter
fcf19ad029 python: work around libnotmuch calling exit(3) in Database.get_directory
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 21:14:35 +01:00
Justus Winter
35ceaf496f python: Improve the docstring of Database.get_directory
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 21:14:35 +01:00
Justus Winter
92983dd14e python: avoid using a magic value for database mode in Database.__init__
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-22 21:14:35 +01:00
Justus Winter
0b2ff308ec python: fix the type nonsense of the first parameter of class Directory
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-21 01:06:15 +01:00
Justus Winter
c1094bc2d7 python: allow an empty path as parameter to Database.get_directory
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-21 00:56:07 +01:00
Justus Winter
786f9882e8 python: remove :returns: keywords from functions returning nothing
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-21 00:15:59 +01:00
Justus Winter
1737ff5290 python: rework Directory.set_mtime
Fix the indentation within the docstring, remove useless remarks, do
some trivial refactoring.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-21 00:13:20 +01:00
Justus Winter
798b74e859 python: harmonize the sphinx keyword for exceptions
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-21 00:01:23 +01:00
Justus Winter
a1442952d4 python: refactor the error handling machinery
Raise specific error classes instead of a generic NotmuchError with an
magic status value (e.g. NotmuchError(STATUS.NULL_POINTER) ->
NullPointerError()), update the documentation accordingly.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-20 23:49:07 +01:00
Justus Winter
4bb9f59ff6 python: fix the projects name and update years of the copyright notice in the sphinx docs
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-20 21:48:35 +01:00
Justus Winter
be851ad39d python: more error handling fixes
This is a follow up commit to 221c7e0b38
fixing more NULL pointer checks.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-19 00:36:15 +01:00
Justus Winter
ab2f9fd828 python: remove trailing whitespace within the documentation source files
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:41:23 +01:00
Justus Winter
bf6039e34e python: improve Query.count_messages docstring
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:39:39 +01:00
Justus Winter
ff8f864245 python: wrap notmuch_query_count_threads as Query.count_threads
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:39:39 +01:00
Justus Winter
4315ac015a python: refactor Query class
Put each libnotmuch function reference right in front of the
corresponding python wrapper.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:13:06 +01:00
Justus Winter
5d69d272c3 python: move Query class to its own file
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:10:45 +01:00
Justus Winter
ff287531ca python: remove unused but imported symbol
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 01:01:33 +01:00
Justus Winter
c471d44837 python: remove unused but imported symbol
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-18 00:57:59 +01:00
Justus Winter
36ce7e3c98 python: implement the context manager protocol for database objects
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-15 22:41:16 +01:00
Justus Winter
b2734519db python: provide a Database.close function
Rename Database.__del__ to Database.close, move it just below the open
function and call close() in a newly created destructor just below the
constructor.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-15 22:25:13 +01:00
Justus Winter
bb514d7862 py3k: Fix decoding of default database name in Database._get_user_default_db
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-10 22:34:47 +01:00
Justus Winter
ae376c774e python: mock out the ctypes library
This allows rtfd.org to build the documentation without libnotmuch.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-10 18:55:33 +01:00
Justus Winter
8c5be7d12d python: Add a Mock class to the sphinx config that can be used to mock modules
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-02-10 18:54:49 +01:00
David Bremner
d43f6c00b3 Merge commit '0.11.1'
Conflicts:
	NEWS
	bindings/python/notmuch/database.py
	bindings/python/notmuch/message.py
	notmuch.1

NEWS merged by hand, others taken from master.
2012-02-04 12:01:46 -05:00
David Bremner
c10b780b44 version: bump to 0.11.1
also semi-automatically update man page and python bindings versions.
2012-02-03 08:32:49 -04:00
Justus Winter
221c7e0b38 python: fix error handling
Before 3434d1940 the return values of libnotmuch functions were
declared as c_void_p and the code checking for errors compared the
returned value to None, which is the ctypes equivalent of a NULL
pointer.

But said commit wrapped all the data types in python classes and the
semantic changed in a subtle way. If a function returns NULL, the
wrapped python value is falsish, but no longer equal to None.

Backported from master to 0.11.
2012-01-23 07:44:08 -04:00
Justus Winter
8015cbff26 python: fix error handling
Before 3434d1940 the return values of libnotmuch functions were
declared as c_void_p and the code checking for errors compared the
returned value to None, which is the ctypes equivalent of a NULL
pointer.

But said commit wrapped all the data types in python classes and the
semantic changed in a subtle way. If a function returns NULL, the
wrapped python value is falsish, but no longer equal to None.
2012-01-22 06:14:57 +01:00
Justus Winter
7ddd849015 py3k: add a specialized version of _str for python3
All strings are unicode strings in python 3 and the basestring and
unicode types are removed hence the need for a specialized version.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-01-16 13:43:11 +01:00
David Bremner
0bbfc5ce8b Merge branch 'release'
Conflicts:
	notmuch-reply.c
	notmuch.1
2012-01-13 20:52:01 -04:00
David Bremner
9ada8335c6 Update version to 0.11 2012-01-13 19:58:36 -04:00
David Bremner
310608f279 version: update to 0.11~rc3
We found another serious-ish bug during freeze.
2012-01-09 07:05:40 -04:00
Sebastian Spaeth
228d8c0528 python: str.decode() doesn't like kwargs in python 2.5
Recent changes introduced lots of unicodification of strings, mostly in
the form of .decode('utf-8', errors='ignore'). However, python 2.5 does
not like the errors keyword argument and complains. It does work when
used as a simple arg though, so that's what this patch does.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-01-02 17:07:53 +01:00
Justus Winter
ada246aa20 python: make the result of Message.get_replies() more pythonic
Formerly Message.get_replies() returned an iterator or None forcing
users to check the result before iterating over it leading to strange
looking code at the call site.

Fix this flaw by adding an EmptyMessagesResult class that behaves like
the Messages class but immediatly raises StopIteration if used as an
iterator and returning objects of this type from Message.get_replies()
to indicate that there are no replies.
2012-01-02 17:01:40 +01:00
Justus Winter
e32c8a5e6b python: refactor print_messages into format_messages and print_messages 2012-01-02 16:55:53 +01:00
Justus Winter
83b256b12b python: add missing conversions from and to utf-8 2012-01-02 16:34:56 +01:00
Justus Winter
4a6642a2a1 py3k: Add and use a mixin class that implements __str__
Amended by Sebastian Spaeth <Sebastian@SSpaeth.de> to include the
required sys import in globals.py.
2012-01-02 16:33:29 +01:00
Justus Winter
26d52cf6cf py3k: Rename .next() to __next__(), add python2.x compatibility alias 2012-01-02 16:12:28 +01:00
Justus Winter
9c32ee5372 py3k: All strings are unicode strings in py3k 2012-01-02 16:11:52 +01:00
Justus Winter
4ed0362d41 py3k: The ConfigParser module has been renamed to configparser 2012-01-02 16:08:32 +01:00
Justus Winter
676ce952d3 py3k: The execfile built-in has been removed in python 3 2012-01-02 16:06:59 +01:00
David Bremner
ff58a06e83 version: bump to 0.11~rc2
This to "celebrate" pushing a bugfix in at the last minute.
2012-01-02 06:50:07 -04:00
David Bremner
c616ada489 version: update version to 0.11~rc1
and keep python, man page, and debian package in sync.
2011-12-25 23:09:17 -04:00
David Bremner
f0e0053149 Merge branch 'release'
Conflicts:
	NEWS

Conflicts resolved by inserting the 0.10.2 stanza before 0.11
2011-12-06 19:39:33 -04:00
Patrick Totzke
c4d824bc1e fix format string in Message.__unicode__
Since 2b01161191, Message.__str__ doesn't
construct a hash containing the thread data before
constructing the formatstring. This changes the formatstring
to accept positional parameters instead of a hash.
2011-12-06 21:56:40 +01:00
Sebastian Spaeth
50b0d0b8ad python: Remove stray debug comment
This slipped in wrongly in commit 71e0082eff (due to my fault).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-12-06 13:36:48 +01:00
Thomas Jost
71e0082eff python: use wrapped notmuch_*_t types instead of raw pointers
Now that types are checked correctly, we also need to make sure that all the
arguments actually are instances of these types. Otherwise the function calls
will fail and raise an exception similar to this one:
   ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: expected
   LP_LP_NotmuchMessageS instance instead of pointer to c_void_p
2011-12-06 13:34:30 +01:00
Patrick Totzke
672b6337b4 errors='ignore' when decode to unicode 2011-12-06 13:28:39 +01:00
Patrick Totzke
ffe3097e58 use __unicode__ for string representation 2011-12-06 13:27:08 +01:00
Patrick Totzke
2b01161191 clean up Thread.__str__ 2011-12-06 13:21:42 +01:00
Sebastian Spaeth
ecf8da35e2 python: Return a STATUS value in tags_to_flags and flags_to_tags
We were not returning anything at all, which does not match the API
documentation. Fixed. Thanks to Patrick Totzke for the heads up.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-12-06 12:38:52 +01:00
Patrick Totzke
86b0aeb1ca remove unused imports 2011-12-06 12:28:35 +01:00
Patrick Totzke
12ebf87947 fix sphinx compile-time warnings
no changes to the code, only makes compiling the docs smoother
as some rsT syntax errors were fixed
2011-12-06 12:23:50 +01:00
Patrick Totzke
4292b1197d pep8 fixes
no changes to the code, only fixed stuff denounced by `pep8 *py`
2011-12-06 12:20:45 +01:00
David Bremner
d7276c6241 version: bump for bugfix release 0.10.2 2011-12-05 18:07:00 -04:00
Justus Winter
3434d19402 python: annotate all calls into libnotmuch with types
Add type information to the ctypes._FuncPtr wrappers and
use the wrapper classes instead of c_void_p for pointers
to notmuch_*_t.

This enables the ctypes library to type check parameters
being handed to functions from the notmuch library.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-12-01 22:24:19 +01:00
Justus Winter
e92b438f46 python: add classes to wrap all notmuch_*_t types
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-12-01 22:24:12 +01:00
David Bremner
f3ad20b20a version: update to 0.10.1 2011-11-25 12:11:04 -05:00
David Bremner
1915c14a3a version: update to 0.10 2011-11-23 07:37:02 -04:00
David Bremner
eb88cd977b version: update version info for 0.10~rc2
Arguably editing debian/changelog violates the "do one thing at a
time" rule, but all of these versions need to be kept in sync.
2011-11-19 08:24:30 -04:00
David Bremner
6b8fd9dd41 version: update to 0.10~rc1
and the usual dance with the python bindings version.
2011-11-15 19:46:08 -04:00
David Bremner
8603396861 version: bump to 0.9
also bump python bindings version.
2011-10-11 21:50:56 -03:00
David Bremner
af1dc7ef48 version: bump to 0.9~rc2
We continue to keep the python bindings version in sync manually
2011-10-07 22:42:18 -03:00
Sebastian Spaeth
dba9c31335 python: Set status in the class definitions
Technically, this is a superfluous change, as the self.status variable
currently gets set in NotmuchErrors's __new__ function. However, in the
long run I would like to get rid of the weird __new__ implementation which
might be somewhat confusing for users (NotmuchError(status) returns a
different class, e.g. OutOfMemoryError)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 17:57:46 +02:00
Sebastian Spaeth
5e75398c80 python: help function Query._assert_query_is_initialized
Remove code duplication by using the new helper function. Also raise the
new fine grained exceptions in many cases, rather than the more generic
NotmuchErrors.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 17:55:30 +02:00
Sebastian Spaeth
42f184c236 python: clean up docstrings and API documentation
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 17:54:09 +02:00
Sebastian Spaeth
a8db280f58 python: whitespace fixed in docstrings
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 17:05:37 +02:00
Sebastian Spaeth
2b43a65c1c python: Add the new exception types in the API documentation
as they should be documented...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 16:58:13 +02:00
Sebastian Spaeth
05926adf73 python: Catch up with find_message(by_filename) API changes
message is now an out parameter, and we get an additional status code as
a result. Hurray \o/.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 16:44:35 +02:00
Sebastian Spaeth
70479753a6 python: also use libnotmuch.so.2
Catch up with the major version bump. I wonder if this could somehow be
automatically made the correct version number. Oh well, I hope it
doesn't change too often :-).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-10-05 15:46:03 +02:00
Ali Polatel
5c00af46ec ruby: Fix macros, use quoting
Fix Data_Get_Notmuch_* macro definitions broken by prev. commit
Adequate quoting for Data_Get_Notmuch_* macros
Remove duplicated RSTRING_PTR() macros, move it to defs.h
2011-10-04 16:57:33 +03:00
Ali Polatel
c8a88fe95d ruby: Really add wrappers for database_find_message*
Commit 898613116d only added wrapper
functions but did not register them. Register the functions in module's
initialization function.
2011-10-04 16:48:34 +03:00
Ali Polatel
05dddf883d ruby: be consistent with notmuch's coding style
No functional change, just indentation
2011-10-04 16:43:40 +03:00
Ali Polatel
898613116d ruby: Add wrappers for database_find_message*
Two new wrappers:
Notmuch::Database.find_message(id) => Notmuch::Message or nil
Notmuch::Database.find_message_by_filename(path) => Notmuch::Message or nil
2011-10-04 16:06:20 +03:00
Thomas Jost
a859d1c866 python: fix Message.get_filenames()
Previously, the Filenames generator only yielded *one* filename before
returning, making Message.get_filenames() behave as Message.get_filename(). This
commit fixes this incorrect behavior: now the generator yields all the
filenames, as expected.
2011-10-01 00:40:20 +02:00
Sebastian Spaeth
8c51525e82 python: rework creating of Subclasses
Add some smart magic, so that when we invoke a
NotmuchError(STATUSVALUE), a nicely derived subclass is created, e.g. a
OutOfMemoryError. This way users can easily distinguish between error
types, while still catching NotmuchError.

I have tested this, and hope it works for others too.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-30 16:04:42 +02:00
Justus Winter
b6a01735d2 python: provide more exception classes
To make the exception handling more effective in code using the
python bindings it is necessary to differentiate between the
different kind of failures.

Add an exception class for each status code and add a decode
classmethod to the NotmuchError class that acts as a factory.

Import the new classes in __init__.py so they can be easily
imported by anyone.

Patch modifed by Sebastian Spaeth.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-30 13:58:03 +02:00
Justus Winter
a378a91ba2 python: fix docstring of Message.get_header()
Update the docstring from notmuch.h.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-30 11:08:51 +02:00
Sebastian Spaeth
f63d605835 python: Add new functions in API documentation
Add documentation for the three new functions and add in which version
they have been added.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-29 11:00:43 +02:00
Sebastian Spaeth
eb4cd33e6b python: Improve code documentation
1) Fix added .gitignore from commit dc8a1745 to work on the docs folder
2) Improve in-code developer documentation to produce better
   sphinx-generated documentation. No code changes.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-29 10:47:28 +02:00
Justus Winter
19daa117b9 properly raise exceptions in python bindings
There are various locations where exceptions are constructed but
not raised. This patch adds the necessary raise statements.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:48:06 +02:00
Justus Winter
34990908e7 python: raise a more specific error in Messages.print_messages
Raising Exception is considered bad since the only way to catch
it is to do 'except Exception'. Raising a TypeError is more
appropriate.

Since the format parameter has already been validated, checking
it again is not necessary. Simplify this conditional.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:39:45 +02:00
Justus Winter
f88d985e50 python: rename _verify_dir_initialized to _assert_dir_is_initialized
Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.

Modified by Sebastian Spaeth to apply cleanly again and remove some
blank lines.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-29 09:29:17 +02:00
Justus Winter
94a1bb88aa python: rename _verify_initialized_db to _assert_db_is_initialized
Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.

Modified slightly by Sebastian Spaeth to catch all new instances and
remove some blank lines too.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:23:13 +02:00
Justus Winter
c16e47fe23 python: fix NotmuchError.__str__ if status == None
Passing None to STATUS.status2str raises an ArgumentError. Add a
check for this case and provide a generic message.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:16:34 +02:00
Justus Winter
fc2d353eeb python: add status and message attributes to NotmuchError
Providing exception objects with meaningful attribute names
is much nicer than using e.args[].

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:07:11 +02:00
Justus Winter
dc8a1745e1 python: add a .gitignore file and refine the toplevel one
The line 'notmuch' in the toplevel .gitignore file is to broad
and matches bindings/python/notmuch making it cumbersome to
git-add files within that directory.

Refine the toplevel file to only match the generated notmuch
executable and add a more specialized .gitignore file to the
python directory.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2011-09-29 09:04:50 +02:00
Sebastian Spaeth
0241a68e9e python: add begin|end_atomic bindings
* Add UNBALANCED_ATOMIC status code
  Catch up with the notmuch status codes, and add the UNBALANCED_ATOMIC
  one.
* Add the begin_atomic and end_atomic calls to libnotmuch

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-28 18:31:49 +02:00
Sebastian Spaeth
2c76279cda python: Add database_find_message_by_filename bindings
Add it :-)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-28 18:31:36 +02:00
David Bremner
78d39a0908 version: bump to 0.9~rc1
This version number change should not be taken as definitive, rather
refer to the signed tag.
2011-09-24 20:00:29 -03:00
Ali Polatel
59d2457bcc ruby: New exception Notmuch::UnbalancedAtomicError
This exception wraps NOTMUCH_STATUS_UNBALANCED_ATOMIC which was added
with the commit e59cc0031f.
2011-09-24 15:54:45 +03:00
Ali Polatel
bbb41081d7 ruby: Wrap notmuch_database_{begin,end}_atomic
Adding ruby wrappers for functions:
- notmuch_database_begin_atomic()
- notmuch_database_end_atomic()
added by 957f1ba3fc

New functions:
Notmuch::Database.begin_atomic()
Notmuch::Database.end_atomic()
2011-09-24 15:43:43 +03:00
Ali Polatel
a08aa32b44 ruby: Rename destroy to destroy!
According to the common Ruby function naming convention, potentially
dangerous functions or functions which operate on the object itself are
suffixed with an exclamation mark. Both of these are true for object
destroying functions.

The following modules are affected:
- Notmuch::Directory
- Notmuch::FileNames
- Notmuch::Query
- Notmuch::Threads
- Notmuch::Thread
- Notmuch::Messages
- Notmuch::Message
- Notmuch::Tags
2011-09-24 15:25:24 +03:00
Martin Owens
8e7a108363 python: Ensure that we pass utf-8 encoded string to libnotmuch
If we use unicode objects, libnotmuch would not cope with null bytes in
the byte array, so we need to make sure they are nicely formatted as
utf-8.

Introduce a helper function _str which does this throughout the code.

Patch slightly modified by Sebastian Spaeth.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-16 13:19:14 +02:00
David Bremner
24fc8f97e8 update versions for release 0.8
See commit 6979b65 for more discussion.
2011-09-10 08:55:33 -03:00
David Bremner
6979b6533a update versions for release candidate
we now have three files to keep in sync. That seems wrong, but I guess
we will live with it for now.

The main problem is that the python code is distributed separately, so
it can't get the version from 'version'.

The choice ~rcX is for convenience with debian versioning.
2011-09-06 22:55:01 -03:00
Sebastian Spaeth
e2e0d487ba python: Make Database take unicode paths
Decode and Encode from/to unicode objects as required to be able to take
unicode path names. Previously we would error out when an unicode object
were handed it.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-05 15:52:12 +02:00
Sebastian Spaeth
5dc189c82d python: Have setup.py read the version number without importing
Importing the notmuch module in setup.py is a no-no, and we want
to auto-generate the version number in the release process.

Outsource __VERSION__ to the new version.py which contains nothing else
and which can therefor easily be autogenerated. Have setup.py read in
the file via execfile and test if importing the version number actually
worked.

This should make all happy.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-24 09:13:34 +02:00
Sebastian Spaeth
2fceb738c7 python: Updated development status and wording in setup.py
We are beyond pre-alpha, and the Requirements wording could take some
tweaking. Done.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-24 09:01:50 +02:00
Sebastian Spaeth
73f104445b Revert "python: Simplify setup.py"
This reverts commit 8826fc2d7b.

It seems that importing the module in setup.py is controversial at best,
as it will fail for users that don't have all dependencies
installed. This was the case in e.g. the Ubuntu autobuilder, so building
notmuch failed. The plan is to create an autogenerated setup.py that can
be used for version information.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-24 08:54:58 +02:00
Sebastian Spaeth
8826fc2d7b python: Simplify setup.py
We were using a template setup.py which parsed __init__.py in complex
ways just to find out the version number. Simply import notmuch and use
__VERSION__ directly. Also adapt some wording and setup.py values while
going through.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-23 09:30:49 +02:00
pazz
f10ec87cc3 python: Fix unsafe utf-8 decodings
This prevents unsafe calls to decode for return value None in
get_authors/get_subject which would current throw an Exception. Original
patch modified by Sebastian Spaeth.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-17 14:44:45 +02:00
patrick
ee4579ad27 decode headers from utf-8 to unicode
as mail headers are stored as utf-8 in the index,
it is safe to return them as unicode strings directly
2011-08-15 15:48:50 +02:00
Sebastian Spaeth
dc6b2b4382 python: remove Tags().__len__() implementation
len() exhausts the tag iterator and e.g. list() or "".join(tags)
implicitly call len() if existing and then failing. So, we remove
Tags.__len__().

If you need to know the number of tags a message has, do use
len(list(tags)). It would be nicer to be able to support len() directly...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-09 17:48:27 +02:00
Sebastian Spaeth
94c5edd064 python: Do explicitly check if the next tag exists
If we try to pull a non-existing tag, Tags._get will return None and the
appended .decode() command will fail. So make sure that there is a tag to
be fetched before fetching it.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-09 17:45:44 +02:00
pazz
e75fd0d937 python: pep8 compliance for __init__.py 2011-08-09 17:28:24 +02:00
pazz
61b96f2c24 python: pep8 compliance for thread.py 2011-08-09 17:28:24 +02:00
pazz
be7947f459 python: pep8 compliance for tag.py 2011-08-09 17:28:24 +02:00
pazz
c49bcfd4e2 python: pep8 compliance for globals.py 2011-08-09 17:28:24 +02:00
pazz
8176326f30 python: pep8 compliance for filename.py 2011-08-09 17:28:24 +02:00
pazz
e69e30edd7 python: pep8 compliance for database.py 2011-08-09 17:28:24 +02:00
pazz
61f0184707 python: pep8 compliance for message.py 2011-08-09 17:28:24 +02:00
Sebastian Spaeth
9562c7d1fb python: Really throw an error if search_threads() fails
In case, search_threads returns an error we are supposed to throw an
Exception. But we did not "raise" it, this was an oversight and this
commit fixes it.

There is still the problem that there is often output to stderr by
libnotmuch detailing the xapian error and this is simply printed
out. But this requires fixing at the libnotmuch level...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-09 16:51:03 +02:00
Cedric Cabessa
805d737029 python: Fix copy'n paste typo
we accessed a wrong attribute due to a copy and paste error. Thanks for
catching this.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-08-09 16:34:02 +02:00
Ali Polatel
20aa9b1b7e ruby: Fix typo in documentation
It's Notmuch::FileNames not Notmuch::Filenames
2011-07-29 09:45:16 +03:00
Ali Polatel
e213439cdc ruby: Remove the split file hack from rdoc.sh 2011-07-29 09:44:44 +03:00
Ali Polatel
6ef8e018f8 ruby: Add markers to method definitions to help rdoc
rdoc is dumb and needs markers in method definitions so that she can
find which source file the method is defined in
2011-07-29 09:29:54 +03:00
Ali Polatel
666ef9f5f6 ruby: Document remaining undocumented constants 2011-07-29 09:16:12 +03:00
Ali Polatel
517faab24e ruby: Document constants and exceptions right before definition 2011-07-29 09:09:28 +03:00
Ali Polatel
00dfa0a17d ruby: Add list of classes to main documentation 2011-07-29 08:53:02 +03:00
Sebastian Spaeth
687366b920 python: represent message tags as unicode instances
Rather than returning simply strings and having to guess their encoding,
return explicit unicode() strings for the tags. Xapian stores UTF8, so
we know that they come as UTF8 encoded string.

Note: I tried to directly use the c_wchar_p type of the ctypes library
which translates directly into an unicode type, but that did not work
out so well, so we take c_char_p and .decode() them manually.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-07-11 15:02:12 +02:00
Sebastian Spaeth
504b6242d1 python: Encode query string as a utf-8 byte array
If we pass in an unicode instance as query string, we would probably get
weird behavior (and indeed do so, see mail
id:"20110707113700.GA16347@megatron"). If a unicode instance is passed
in, make sure we encode it properly to an utf-8 encoded byte string.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-07-11 11:46:54 +02:00
Sebastian Spaeth
3545a2960d python: Fix Database().needs_upgrade()
A stupid typo was preventing this from ever working and it was not
detected until now. Patrick noted the typo and proposed the fix in mail
id:"20110704203926.GA20238@brick.lan".

Patch-by: Patrick Totzke <patricktotzke@googlemail.com>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-07-08 22:47:06 +02:00
Sebastian Spaeth
e59eaa5ddd python: Do not implicitely call maildir_flags_to_tags etc
In order to remain consistent with the underlying C API, we do not
automatically synchronize notmuch tags and maildir flags anymore.

The underlying functions Message.maildir_flags_to_tags and
Message.tags_to_maildir_flags still exist and are available to the user.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-24 08:44:06 +02:00
David Bremner
c39b492c19 Do not import notmuch in setup.py.
Importing notmuch loads the notmuch shared library. When building
without a system install of notmuch, this requires e.g. setting
LD_LIBRARY_PATH for building and fails completely for cleaning.
2011-06-20 09:45:43 +02:00
Sebastian Spaeth
12d6f90e77 Simplify (& fix) Message().__str__()
We were still using len(self.get_replies()) for the __str__ summary of a
mail, but 1) len(Messages()) has just gone away 2) the number of replies
can not be retrieved when we got the message via search_messages()
anyway, and 3) it is likely quite expensive to pull all replies for all
messages that we display a summary of.

So we fix this by simplifying str(Message()) to omit the number of replies.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-16 17:33:47 +02:00
Sebastian Spaeth
995303c21b python: Bulletproof Database() path parameter
libnotmuch (and python) crashed when I accidently passed in an invalid
value as path argument to the Database() instantiation.

Therefore, we now check via assert that the handed in path is actually a
real string (or None).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-16 15:51:13 +02:00
Sebastian Spaeth
0817f0e168 python: Improve API documentation
Various API doc cleanups and improvements. No code change.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-16 15:41:48 +02:00
Sebastian Spaeth
d8c0e0c72d Implement Message.tags_to_maildir_flags
and also maildir_flags_to_tags. The methods will be invoked by
db.add_message() and also (if not overridden via function parameter) by
add|remove_tag and remove_all_tags. Documentation on the usage has been
updated.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-16 14:41:02 +02:00
Sebastian Spaeth
b4049316cc python: Improve documentation
Improve the documentation with regard to the new __cmp__ and __hash__
methods and the implications of doing set arithmetic with Messages()
objects.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-15 21:36:26 +02:00
Sebastian Spaeth
4557af3064 python: Implement Message.__cmp__ and __hash__
We can now do: if msg1 == msg2, and we can use set arithmetic on
Messages():
  s1, s2= msgs1, msgs2
  s1.union(s2)
  s2 -= s1

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-15 15:05:47 +02:00
Sebastian Spaeth
8866a89e3c python: Remove Messages().__len__
Messages.__len__() exhausted the iterator and list() inherently calls
len(), so we could not invoke list(msgs) without getting errors. Fix
this by implementing __nonzero__ but removing __len__ on Messages.

Use Query.count_messages() or len(list(msgs)) if you need to know the
number.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-15 14:25:33 +02:00
Sebastian Spaeth
6ae4e7d88b bindings/python: Bump bindings version to 0.6
To match the upcoming release, and with the updated API to match the
current libnotmuch, bump the python version number (notmuch.__VERSION__)
to 0.6.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-02 17:44:23 +02:00
Sebastian Spaeth
aeecafa694 bindings/python: Implement Tags().__nonzero__()
Analog to Threads.__nonzero__ this allows us to perform list() on a Threads() object and to repeatedly call "if Tags():" or "bool(Tags())" without implicitly invoking len(), thus exhausting our iterator.

While touching this code, I added a small micro-optimization to the Tag next() function. There is no need to explicitly check _is_valid, as _get implicitly does check for validness and returns None, if there is no more Tag to fetch. This avoids some roundtrips into the library when iterating through Tags.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-02 17:28:50 +02:00
Sebastian Spaeth
01cc4a3115 bindings/python: implement Threads().__nonzero__
__nonzero__ checks if Threads() contains at least one more valid thread

 The existence of this function makes 'if Threads(): foo' work, as that
 previously implicitely called len() exhausting the iterator. This
 function makes `bool(Threads())` work repeatedly.

For further info, see http://docs.python.org/reference/datamodel.html.
Credits for the hint go to Brian May.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-02 16:28:00 +02:00
Sebastian Spaeth
4d406d9c25 bindings/python: Include the new get_filenames in the API docs
They had accidentally been left out, so we should also include the
function docs for get_messages in the API docs.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-02 09:20:56 +02:00
Sebastian Spaeth
b31247c354 bindings/python: Implement Message().get_filenames()
Message().get_filenames() will return a generator that allows to
iterator over the recorded filenames for a certain Message. Do ntoe that
as all generators, these are one-time use only. You will have to reget
them to perform various actions. So this works::

  len(Message().get_filenames())
  list(Message().get_filenames())
  for n in Message().get_filenames():
    print n

But this won't::

  names = Message().get_filenames()
  len(names) #uses up the iterator
  list(names) #outch, already used up...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-02 09:03:18 +02:00
Carl Worth
f35db275c4 python: Update README to talkabout notmuch, not cnotmuch
The old instructions were telling users to do "easy_install cnotmuch"
which installed some old, stale bindings. The new instructions should
be much more effective.
2011-05-24 13:08:18 -07:00
James Vasile
74bc93f02d python: Remove completed TODO item
Really just a left-over TODO item in the code, nothing spectacular to
see here.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-03-16 10:14:30 +01:00
Sebastien Binet
62725a5b59 update for go-release-2011-02-01:
* M bindings/go/cmds/notmuch-addrlookup.go
    log.Exitf -> log.Fatalf
2011-02-03 09:36:58 +01:00
Ali Polatel
ca69ce2397 ruby: Add generated files to .gitignore 2011-02-03 01:40:38 +02:00
Sebastien Binet
38ce0dbf82 Migrate to goconfig pkg 2011-01-26 15:59:19 +10:00
Sebastien Binet
2fcfb1aa50 bindings/go: Add a todo file 2011-01-26 15:59:19 +10:00
Sebastien Binet
a6411b133f A minor, cosmetic change
Just trying to keep the line lengths in check.
2011-01-26 15:59:19 +10:00
Sebastien Binet
c234f8f972 Initial import of Go bindings for notmuch 2011-01-26 15:59:19 +10:00
Ali Polatel
90a66779e1 ruby: Add wrapper for message_get_filenames 2011-01-25 12:03:41 +02:00
Ali Polatel
02369d031c ruby: Add wrappers for maildir sync. interface
New wrappers:
notmuch_message_maildir_flags_to_tags(): MESSAGE.maildir_flags_to_tags
notmuch_message_tags_to_maildir_flags(): MESSAGE.tags_to_maildir_flags
2011-01-25 12:03:37 +02:00
Ali Polatel
ed38940323 ruby: Add wrappers for query_get_s{ort,tring}
New wrappers:
notmuch_query_get_sort(): QUERY.sort
notmuch_query_get_query_string(): QUERY.to_s
2011-01-25 12:03:32 +02:00
Sebastian Spaeth
3c7a52890c python: Update metainformation to point to new URL and version number
Convert the meta information to point to the notmuchmail.org repository, rather
than the old cnotmuch location. I will delete the "cnotmuch" package
from http://pypi.python.org/pypi/cnotmuch and create a new "notmuch"
package there that contains the current versions.

Also bump the version number to 0.4. I will need to upgrade the API
first before I can release the 0.5 of the bindings, there are still some
methods missing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-01-13 12:35:59 +01:00
Carl Worth
44ea57a0d1 Merge in ruby bindings.
Thanks to Ali Polatel for these bindings. This code was fetched from
the ruby branch of:

	git://github.com/alip/notmuch.git
2010-11-08 10:08:34 -08:00
Sebastian Spaeth
c8bdd29895 python: lambda(p) is not P3k-compliant
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-10-28 12:12:10 -07:00
Sebastian Spaeth
35042e0696 python: Import explicit including package name
To make python3 happy

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-10-28 12:12:04 -07:00
Ali Polatel
5c9e385591 ruby: Don't barf if an object is destroyed more than once
Raise RuntimeError instead.
Also revise Notmuch::Database a bit.
Add Notmuch::Database.open singleton method.
2010-06-06 09:18:00 +03:00
Ali Polatel
d2a457a5d8 ruby: Use rb_scan_args() 2010-06-06 09:17:57 +03:00
Ali Polatel
c7893408bb ruby: Kill garbage collection related cruft.
Let the user destroy objects that she wants explicitly.
It's not possible to specify the order objects are garbage collected.
See id:86y6f8v838.fsf@harikalardiyari.ev on ruby-talk for more
information.
2010-06-06 09:17:47 +03:00
Ali Polatel
35925e6e5b ruby: First attempt at fixing gc for ruby-1.9 2010-06-06 09:17:30 +03:00
Ali Polatel
8312e7efea ruby: fix documentation of DB.upgrade! 2010-06-06 09:17:06 +03:00
Ali Polatel
06bf04500b Initial ruby bindings 2010-06-06 09:16:53 +03:00
Sebastian Spaeth
c50524efd5 python: have docs reflect current return value behavior
Database.find_message() used to be able to reliably indicate whether a
message exists or not (in which case it returns None). However, the
recent API change of the notmuch library means we will return None
even for all Xapian exceptions, which happens e.g. when the current
Database has been modified by another project. Therefore the return
value of None cannot be reliably be used to indicate whether a message
exists or not. Make the docs state that explicitely.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-05-18 11:11:59 -07:00
Sebastian Spaeth
af8664689a python: Add UNSORTED as Query.SORT option
Keep up to date with the libnotmuch.so API.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-23 13:40:38 +02:00
Sebastian Spaeth
be7b24eb21 python: Delete unused files
No more .hg files needed in the git repo.
No stock notmuch-test suite needed in a subdirectory.
We have the real one in this repository

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-23 13:40:29 +02:00
Carl Worth
3b558de781 Move everything down into a bindings/python directory.
In preparation for merging the python bindings into the notmuch
repository.
2010-04-21 17:29:34 -07:00