2 This file is part of notmuch.
4 Notmuch is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation, either version 3 of the License, or (at your
7 option) any later version.
9 Notmuch is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with notmuch. If not, see <https://www.gnu.org/licenses/>.
17 Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
20 from ctypes import CDLL, Structure, POINTER
21 from notmuch.version import SOVERSION
23 #-----------------------------------------------------------------------------
24 #package-global instance of the notmuch library
27 if uname()[0] == 'Darwin':
28 nmlib = CDLL("libnotmuch.{0:s}.dylib".format(SOVERSION))
30 nmlib = CDLL("libnotmuch.so.{0:s}".format(SOVERSION))
32 raise ImportError("Could not find shared 'notmuch' library.")
34 from .compat import Python3StringMixIn, encode_utf8 as _str
36 # We import these on behalf of other modules. Silence warning about
37 # these symbols not being used.
42 """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
43 def __init__(self, names):
44 for number, name in enumerate(names):
45 setattr(self, name, number)
48 class NotmuchDatabaseS(Structure):
50 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
53 class NotmuchQueryS(Structure):
55 NotmuchQueryP = POINTER(NotmuchQueryS)
58 class NotmuchThreadsS(Structure):
60 NotmuchThreadsP = POINTER(NotmuchThreadsS)
63 class NotmuchThreadS(Structure):
65 NotmuchThreadP = POINTER(NotmuchThreadS)
68 class NotmuchMessagesS(Structure):
70 NotmuchMessagesP = POINTER(NotmuchMessagesS)
73 class NotmuchMessageS(Structure):
75 NotmuchMessageP = POINTER(NotmuchMessageS)
78 class NotmuchMessagePropertiesS(Structure):
80 NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
83 class NotmuchTagsS(Structure):
85 NotmuchTagsP = POINTER(NotmuchTagsS)
88 class NotmuchDirectoryS(Structure):
90 NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
93 class NotmuchFilenamesS(Structure):
95 NotmuchFilenamesP = POINTER(NotmuchFilenamesS)
98 class NotmuchConfigListS(Structure):
100 NotmuchConfigListP = POINTER(NotmuchConfigListS)
103 class NotmuchIndexoptsS(Structure):
105 NotmuchIndexoptsP = POINTER(NotmuchIndexoptsS)