diff options
| author | David Bremner <bremner@debian.org> | 2012-06-17 07:38:59 -0300 |
|---|---|---|
| committer | David Bremner <bremner@debian.org> | 2012-06-17 07:38:59 -0300 |
| commit | 3dc2ff6fc73d3a057ae0a3f350c42b077d7ec273 (patch) | |
| tree | 19322fd5112777d877a7e31eef3efbc4ac0ef6cd /bindings/python | |
| parent | 3b1e8a200dd4740b3c5605256e1535a681367347 (diff) | |
| parent | 2ef24acf03fdd73e39d2c233016e71f194affbcf (diff) | |
Merge branch 'release' into squeeze-backports
Conflicts:
debian/changelog
Diffstat (limited to 'bindings/python')
| -rw-r--r-- | bindings/python/docs/source/database.rst | 2 | ||||
| -rw-r--r-- | bindings/python/docs/source/filesystem.rst | 2 | ||||
| -rw-r--r-- | bindings/python/notmuch/database.py | 96 | ||||
| -rw-r--r-- | bindings/python/notmuch/directory.py | 4 | ||||
| -rw-r--r-- | bindings/python/notmuch/filenames.py | 75 | ||||
| -rw-r--r-- | bindings/python/notmuch/globals.py | 4 | ||||
| -rw-r--r-- | bindings/python/notmuch/message.py | 37 | ||||
| -rw-r--r-- | bindings/python/notmuch/messages.py | 18 | ||||
| -rw-r--r-- | bindings/python/notmuch/query.py | 4 | ||||
| -rw-r--r-- | bindings/python/notmuch/tag.py | 20 | ||||
| -rw-r--r-- | bindings/python/notmuch/thread.py | 4 | ||||
| -rw-r--r-- | bindings/python/notmuch/threads.py | 23 | ||||
| -rw-r--r-- | bindings/python/notmuch/version.py | 2 | ||||
| -rw-r--r-- | bindings/python/setup.py | 61 |
14 files changed, 181 insertions, 171 deletions
diff --git a/bindings/python/docs/source/database.rst b/bindings/python/docs/source/database.rst index ee71085f..2464bfff 100644 --- a/bindings/python/docs/source/database.rst +++ b/bindings/python/docs/source/database.rst @@ -9,6 +9,8 @@ .. automethod:: open(path, status=MODE.READ_ONLY) + .. automethod:: close + .. automethod:: get_path .. automethod:: get_version diff --git a/bindings/python/docs/source/filesystem.rst b/bindings/python/docs/source/filesystem.rst index 685dc4d3..4eb78107 100644 --- a/bindings/python/docs/source/filesystem.rst +++ b/bindings/python/docs/source/filesystem.rst @@ -10,8 +10,6 @@ Files and directories .. automethod:: Filenames.__len__ - .. automethod:: Filenames.as_generator - :class:`Directoy` -- A directory entry in the database ------------------------------------------------------ diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 44d40fdb..e5c74cfb 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ import os @@ -56,21 +56,14 @@ class Database(object): :class:`Database` objects implement the context manager protocol so you can use the :keyword:`with` statement to ensure that the - database is properly closed. + database is properly closed. See :meth:`close` for more + information. .. note:: Any function in this class can and will throw an :exc:`NotInitializedError` if the database was not intitialized properly. - - .. note:: - - Do remember that as soon as we tear down (e.g. via `del db`) this - object, all underlying derived objects such as queries, threads, - messages, tags etc will be freed by the underlying library as well. - Accessing these objects will lead to segfaults and other unexpected - behavior. See above for more details. """ _std_db_path = None """Class attribute to cache user's default database""" @@ -80,8 +73,8 @@ class Database(object): """notmuch_database_get_directory""" _get_directory = nmlib.notmuch_database_get_directory - _get_directory.argtypes = [NotmuchDatabaseP, c_char_p] - _get_directory.restype = NotmuchDirectoryP + _get_directory.argtypes = [NotmuchDatabaseP, c_char_p, POINTER(NotmuchDirectoryP)] + _get_directory.restype = c_uint """notmuch_database_get_path""" _get_path = nmlib.notmuch_database_get_path @@ -95,8 +88,8 @@ class Database(object): """notmuch_database_open""" _open = nmlib.notmuch_database_open - _open.argtypes = [c_char_p, c_uint] - _open.restype = NotmuchDatabaseP + _open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)] + _open.restype = c_uint """notmuch_database_upgrade""" _upgrade = nmlib.notmuch_database_upgrade @@ -122,8 +115,8 @@ class Database(object): """notmuch_database_create""" _create = nmlib.notmuch_database_create - _create.argtypes = [c_char_p] - _create.restype = NotmuchDatabaseP + _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)] + _create.restype = c_uint def __init__(self, path = None, create = False, mode = MODE.READ_ONLY): @@ -161,8 +154,13 @@ class Database(object): else: self.create(path) + _destroy = nmlib.notmuch_database_destroy + _destroy.argtypes = [NotmuchDatabaseP] + _destroy.restype = None + def __del__(self): - self.close() + if self._db: + self._destroy(self._db) def _assert_db_is_initialized(self): """Raises :exc:`NotInitializedError` if self._db is `None`""" @@ -184,16 +182,17 @@ class Database(object): :raises: :exc:`NotmuchError` in case of any failure (possibly after printing an error message on stderr). """ - if self._db is not None: + if self._db: raise NotmuchError(message="Cannot create db, this Database() " "already has an open one.") - res = Database._create(_str(path), Database.MODE.READ_WRITE) + db = NotmuchDatabaseP() + status = Database._create(_str(path), Database.MODE.READ_WRITE, byref(db)) - if not res: - raise NotmuchError( - message="Could not create the specified database") - self._db = res + if status != STATUS.SUCCESS: + raise NotmuchError(status) + self._db = db + return status def open(self, path, mode=0): """Opens an existing database @@ -207,21 +206,31 @@ class Database(object): :raises: Raises :exc:`NotmuchError` in case of any failure (possibly after printing an error message on stderr). """ - res = Database._open(_str(path), mode) + db = NotmuchDatabaseP() + status = Database._open(_str(path), mode, byref(db)) - if not res: - raise NotmuchError(message="Could not open the specified database") - self._db = res + if status != STATUS.SUCCESS: + raise NotmuchError(status) + self._db = db + return status _close = nmlib.notmuch_database_close _close.argtypes = [NotmuchDatabaseP] _close.restype = None def close(self): - """Close and free the notmuch database if needed""" - if self._db is not None: + ''' + Closes the notmuch database. + + .. warning:: + + This function closes the notmuch database. From that point + on every method invoked on any object ever derived from + the closed database may cease to function and raise a + NotmuchError. + ''' + if self._db: self._close(self._db) - self._db = None def __enter__(self): ''' @@ -337,7 +346,6 @@ class Database(object): def get_directory(self, path): """Returns a :class:`Directory` of path, - (creating it if it does not exist(?)) :param path: An unicode string containing the path relative to the path of database (see :meth:`get_path`), or else should be an absolute @@ -345,18 +353,9 @@ class Database(object): :returns: :class:`Directory` or raises an exception. :raises: :exc:`FileError` if path is not relative database or absolute with initial components same as database. - :raises: :exc:`ReadOnlyDatabaseError` if the database has not been - opened in read-write mode """ self._assert_db_is_initialized() - # work around libnotmuch calling exit(3), see - # id:20120221002921.8534.57091@thinkbox.jade-hamburg.de - # TODO: remove once this issue is resolved - if self.mode != Database.MODE.READ_WRITE: - raise ReadOnlyDatabaseError('The database has to be opened in ' - 'read-write mode for get_directory') - # sanity checking if path is valid, and make path absolute if path and path[0] == os.sep: # we got an absolute path @@ -369,7 +368,13 @@ class Database(object): #we got a relative path, make it absolute abs_dirpath = os.path.abspath(os.path.join(self.get_path(), path)) - dir_p = Database._get_directory(self._db, _str(path)) + dir_p = NotmuchDirectoryP() + status = Database._get_directory(self._db, _str(path), byref(dir_p)) + + if status != STATUS.SUCCESS: + raise NotmuchError(status) + if not dir_p: + return None # return the Directory, init it with the absolute path return Directory(abs_dirpath, dir_p, self) @@ -521,19 +526,10 @@ class Database(object): retry. :raises: :exc:`NotInitializedError` if the database was not intitialized. - :raises: :exc:`ReadOnlyDatabaseError` if the database has not been - opened in read-write mode *Added in notmuch 0.9*""" self._assert_db_is_initialized() - # work around libnotmuch calling exit(3), see - # id:20120221002921.8534.57091@thinkbox.jade-hamburg.de - # TODO: remove once this issue is resolved - if self.mode != Database.MODE.READ_WRITE: - raise ReadOnlyDatabaseError('The database has to be opened in ' - 'read-write mode for get_directory') - msg_p = NotmuchMessageP() status = Database._find_message_by_filename(self._db, _str(filename), byref(msg_p)) diff --git a/bindings/python/notmuch/directory.py b/bindings/python/notmuch/directory.py index 284cbdce..ae115f81 100644 --- a/bindings/python/notmuch/directory.py +++ b/bindings/python/notmuch/directory.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from ctypes import c_uint, c_long @@ -181,5 +181,5 @@ class Directory(object): def __del__(self): """Close and free the Directory""" - if self._dir_p is not None: + if self._dir_p: self._destroy(self._dir_p) diff --git a/bindings/python/notmuch/filenames.py b/bindings/python/notmuch/filenames.py index 12050df9..a0b29563 100644 --- a/bindings/python/notmuch/filenames.py +++ b/bindings/python/notmuch/filenames.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from ctypes import c_char_p from notmuch.globals import ( @@ -32,29 +32,32 @@ from .errors import ( class Filenames(Python3StringMixIn): """Represents a list of filenames as returned by notmuch - This object contains the Filenames iterator. The main function is - as_generator() which will return a generator so we can do a Filenamesth an - iterator over a list of notmuch filenames. Do note that the underlying - library only provides a one-time iterator (it cannot reset the iterator to - the start). Thus iterating over the function will "exhaust" the list of - tags, and a subsequent iteration attempt will raise a - :exc:`NotInitializedError`. Also note, that any function that uses - iteration (nearly all) will also exhaust the tags. So both:: + Objects of this class implement the iterator protocol. - for name in filenames: print name + .. note:: - as well as:: + The underlying library only provides a one-time iterator (it + cannot reset the iterator to the start). Thus iterating over + the function will "exhaust" the list of tags, and a subsequent + iteration attempt will raise a + :exc:`NotInitializedError`. Also note, that any function that + uses iteration (nearly all) will also exhaust the tags. So + both:: - number_of_names = len(names) + for name in filenames: print name - and even a simple:: + as well as:: - #str() iterates over all tags to construct a space separated list - print(str(filenames)) + number_of_names = len(names) - will "exhaust" the Filenames. However, you can use - :meth:`Message.get_filenames` repeatedly to get fresh Filenames - objects to perform various actions on filenames. + and even a simple:: + + #str() iterates over all tags to construct a space separated list + print(str(filenames)) + + will "exhaust" the Filenames. However, you can use + :meth:`Message.get_filenames` repeatedly to get fresh + Filenames objects to perform various actions on filenames. """ #notmuch_filenames_get @@ -109,28 +112,13 @@ class Filenames(Python3StringMixIn): return file_.decode('utf-8', 'ignore') next = __next__ # python2.x iterator protocol compatibility - def as_generator(self): - """Return generator of Filenames - - This is the main function that will usually be used by the - user. - - .. deprecated:: 0.12 - :class:`Filenames` objects implement the - iterator protocol. - """ - return self - def __unicode__(self): """Represent Filenames() as newline-separated list of full paths - .. note:: As this iterates over the filenames, we will not be - able to iterate over them again (as in retrieve them)! If - the tags have been exhausted already, this will raise a - :exc:`NotInitializedError` on subsequent - attempts. However, you can use - :meth:`Message.get_filenames` repeatedly to perform - various actions on filenames. + .. note:: + + This method exhausts the iterator object, so you will not be able to + iterate over them again. """ return "\n".join(self) @@ -140,7 +128,7 @@ class Filenames(Python3StringMixIn): def __del__(self): """Close and free the notmuch filenames""" - if self._files_p is not None: + if self._files_p: self._destroy(self._files_p) def __len__(self): @@ -148,15 +136,8 @@ class Filenames(Python3StringMixIn): .. note:: - As this iterates over the files, we will not be able to - iterate over them again! So this will fail:: - - #THIS FAILS - files = Database().get_directory('').get_child_files() - if len(files) > 0: # this 'exhausts' msgs - # next line raises - # NotmuchError(:attr:`STATUS`.NOT_INITIALIZED) - for file in files: print file + This method exhausts the iterator object, so you will not be able to + iterate over them again. """ if not self._files_p: raise NotInitializedError() diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py index 442f3e35..f5fad72a 100644 --- a/bindings/python/notmuch/globals.py +++ b/bindings/python/notmuch/globals.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ import sys from ctypes import CDLL, Structure, POINTER @@ -22,7 +22,7 @@ from ctypes import CDLL, Structure, POINTER #----------------------------------------------------------------------------- #package-global instance of the notmuch library try: - nmlib = CDLL("libnotmuch.so.2") + nmlib = CDLL("libnotmuch.so.3") except: raise ImportError("Could not find shared 'notmuch' library.") diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index 9eb4feef..0e65694e 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> Jesse Rosenthal <jrosenthal@jhu.edu> """ @@ -259,7 +259,7 @@ class Message(Python3StringMixIn): files_p = Message._get_filenames(self._msg) - return Filenames(files_p, self).as_generator() + return Filenames(files_p, self) def get_flag(self, flag): """Checks whether a specific flag is set for this message @@ -614,7 +614,15 @@ class Message(Python3StringMixIn): """Create an internal representation of the message parts, which can easily be output to json, text, or another output format. The argument match tells whether this matched a - query.""" + query. + + .. deprecated:: 0.13 + 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. + """ output = {} output["id"] = self.get_message_id() output["match"] = self.is_match() @@ -660,12 +668,29 @@ class Message(Python3StringMixIn): def format_message_as_json(self, indent=0): """Outputs the message as json. This is essentially the same as python's dict format, but we run it through, just so we - don't have to worry about the details.""" + don't have to worry about the details. + + .. deprecated:: 0.13 + 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. + """ return json.dumps(self.format_message_internal()) def format_message_as_text(self, indent=0): """Outputs it in the old-fashioned notmuch text form. Will be - easy to change to a new format when the format changes.""" + easy to change to a new format when the format changes. + + .. deprecated:: 0.13 + 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. + """ + format = self.format_message_internal() output = "\fmessage{ id:%s depth:%d match:%d filename:%s" \ @@ -741,5 +766,5 @@ class Message(Python3StringMixIn): def __del__(self): """Close and free the notmuch Message""" - if self._msg is not None: + if self._msg: self._destroy(self._msg) diff --git a/bindings/python/notmuch/messages.py b/bindings/python/notmuch/messages.py index d94f91b4..59ef40af 100644 --- a/bindings/python/notmuch/messages.py +++ b/bindings/python/notmuch/messages.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> Jesse Rosenthal <jrosenthal@jhu.edu> """ @@ -172,11 +172,15 @@ class Messages(object): next = __next__ # python2.x iterator protocol compatibility def __nonzero__(self): - """ - :return: True if there is at least one more thread in the - Iterator, False if not.""" - return self._msgs is not None and \ - self._valid(self._msgs) > 0 + ''' + Implement truth value testing. If __nonzero__ is not + implemented, the python runtime would fall back to `len(..) > + 0` thus exhausting the iterator. + + :returns: True if the wrapped iterator has at least one more object + left. + ''' + return self._msgs and self._valid(self._msgs) _destroy = nmlib.notmuch_messages_destroy _destroy.argtypes = [NotmuchMessagesP] @@ -184,7 +188,7 @@ class Messages(object): def __del__(self): """Close and free the notmuch Messages""" - if self._msgs is not None: + if self._msgs: self._destroy(self._msgs) def format_messages(self, format, indent=0, entire_thread=False): diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py index ddaf8e08..756e63b5 100644 --- a/bindings/python/notmuch/query.py +++ b/bindings/python/notmuch/query.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from ctypes import c_char_p, c_uint @@ -203,5 +203,5 @@ class Query(object): def __del__(self): """Close and free the Query""" - if self._query is not None: + if self._query: self._destroy(self._query) diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py index 711bf533..363c3487 100644 --- a/bindings/python/notmuch/tag.py +++ b/bindings/python/notmuch/tag.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from ctypes import c_char_p from notmuch.globals import ( @@ -109,15 +109,15 @@ class Tags(Python3StringMixIn): next = __next__ # python2.x iterator protocol compatibility def __nonzero__(self): - """Implement bool(Tags) check that can be repeatedly used + ''' + Implement truth value testing. If __nonzero__ is not + implemented, the python runtime would fall back to `len(..) > + 0` thus exhausting the iterator. - If __nonzero__ is not implemented, "if Tags()" - will implicitly call __len__, using up our iterator, so it is - important that this function is defined. - - :returns: True if the Tags() iterator has at least one more Tag - left.""" - return self._valid(self._tags) > 0 + :returns: True if the wrapped iterator has at least one more object + left. + ''' + return self._tags and self._valid(self._tags) def __unicode__(self): """string representation of :class:`Tags`: a space separated list of tags @@ -137,5 +137,5 @@ class Tags(Python3StringMixIn): def __del__(self): """Close and free the notmuch tags""" - if self._tags is not None: + if self._tags: self._destroy(self._tags) diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py index a759c909..2f60d493 100644 --- a/bindings/python/notmuch/thread.py +++ b/bindings/python/notmuch/thread.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from ctypes import c_char_p, c_long, c_int @@ -260,5 +260,5 @@ class Thread(object): def __del__(self): """Close and free the notmuch Thread""" - if self._thread is not None: + if self._thread: self._destroy(self._thread) diff --git a/bindings/python/notmuch/threads.py b/bindings/python/notmuch/threads.py index 225f5246..d2e0a910 100644 --- a/bindings/python/notmuch/threads.py +++ b/bindings/python/notmuch/threads.py @@ -14,7 +14,7 @@ for more details. You should have received a copy of the GNU General Public License along with notmuch. If not, see <http://www.gnu.org/licenses/>. -Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>' +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> """ from notmuch.globals import ( @@ -157,18 +157,15 @@ class Threads(Python3StringMixIn): return i def __nonzero__(self): - """Check if :class:`Threads` contains at least one more valid thread + ''' + Implement truth value testing. If __nonzero__ is not + implemented, the python runtime would fall back to `len(..) > + 0` thus exhausting the iterator. - The existence of this function makes 'if Threads: foo' work, as - that will implicitely call len() exhausting the iterator if - __nonzero__ does not exist. This function makes `bool(Threads())` - work repeatedly. - - :return: True if there is at least one more thread in the - Iterator, False if not. None on a "Out-of-memory" error. - """ - return self._threads is not None and \ - self._valid(self._threads) > 0 + :returns: True if the wrapped iterator has at least one more object + left. + ''' + return self._threads and self._valid(self._threads) _destroy = nmlib.notmuch_threads_destroy _destroy.argtypes = [NotmuchThreadsP] @@ -176,5 +173,5 @@ class Threads(Python3StringMixIn): def __del__(self): """Close and free the notmuch Threads""" - if self._threads is not None: + if self._threads: self._destroy(self._threads) diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py index 24e1d4c9..90bcadbe 100644 --- a/bindings/python/notmuch/version.py +++ b/bindings/python/notmuch/version.py @@ -1,2 +1,2 @@ # this file should be kept in sync with ../../../version -__VERSION__ = '0.12' +__VERSION__ = '0.13.2' diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 2e58dab1..f4c338e3 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -1,14 +1,33 @@ #!/usr/bin/env python +""" +This file is part of notmuch. + +Notmuch is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. + +Notmuch is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with notmuch. If not, see <http://www.gnu.org/licenses/>. + +Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> +""" + import os -import re from distutils.core import setup # get the notmuch version number without importing the notmuch module -version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), +version_file = os.path.join(os.path.dirname(__file__), 'notmuch', 'version.py') exec(compile(open(version_file).read(), version_file, 'exec')) -assert __VERSION__, 'Failed to read the notmuch binding version number' +assert '__VERSION__' in globals(), \ + 'Failed to read the notmuch binding version number' setup(name='notmuch', version=__VERSION__, @@ -16,32 +35,20 @@ setup(name='notmuch', author='Sebastian Spaeth', author_email='Sebastian@SSpaeth.de', url='http://notmuchmail.org/', - download_url='http://notmuchmail.org/releases/notmuch-'+__VERSION__+'.tar.gz', + download_url='http://notmuchmail.org/releases/notmuch-%s.tar.gz' % __VERSION__, packages=['notmuch'], - keywords = ["library", "email"], - long_description="""Overview -============== - -The notmuch module provides an interface to the `notmuch <http://notmuchmail.org>`_ functionality, directly interfacing with a shared notmuch library. Notmuch provides a maildatabase that allows for extremely quick searching and filtering of your email according to various criteria. - -The documentation for the latest cnotmuch release can be `viewed online <http://packages.python.org/notmuch>`_. - -The classes notmuch.Database, notmuch.Query provide most of the core functionality, returning notmuch.Messages and notmuch.Tags. - -Installation and Deinstallation -------------------------------- - -notmuch is included in the upstream notmuch source repository and it is -packaged on http://pypi.python.org. This means you can do "easy_install -notmuch" (or using pip) on your linux box and it will get installed -into: + keywords=['library', 'email'], + long_description='''Overview +======== -/usr/local/lib/python2.x/dist-packages/ +The notmuch module provides an interface to the `notmuch +<http://notmuchmail.org>`_ functionality, directly interfacing with a +shared notmuch library. Notmuch provides a maildatabase that allows +for extremely quick searching and filtering of your email according to +various criteria. -For uninstalling, you will need to remove the "notmuch-0.x-py2.x.egg" -directory and delete one entry refering to cnotmuch in the -"easy-install.pth" file in that directory. There should be no trace -left of cnotmuch then. +The documentation for the latest notmuch release can be `viewed +online <http://notmuch.readthedocs.org/>`_. Requirements ------------ @@ -49,7 +56,7 @@ Requirements You need to have notmuch installed (or rather libnotmuch.so.1). Also, notmuch makes use of the ctypes library, and has only been tested with python >= 2.5. It will not work on earlier python versions. -""", +''', classifiers=['Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License (GPL)', |
