]> git.cworth.org Git - notmuch-old/blob - bindings/python/notmuch/globals.py
Import notmuch_0.28.2.orig.tar.gz
[notmuch-old] / bindings / python / notmuch / globals.py
1 """
2 This file is part of notmuch.
3
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.
8
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
12 for more details.
13
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/>.
16
17 Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
18 """
19
20 from ctypes import CDLL, Structure, POINTER
21 from notmuch.version import SOVERSION
22
23 #-----------------------------------------------------------------------------
24 #package-global instance of the notmuch library
25 try:
26     from os import uname
27     if uname()[0] == 'Darwin':
28         nmlib = CDLL("libnotmuch.{0:s}.dylib".format(SOVERSION))
29     else:
30         nmlib = CDLL("libnotmuch.so.{0:s}".format(SOVERSION))
31 except:
32     raise ImportError("Could not find shared 'notmuch' library.")
33
34 from .compat import Python3StringMixIn, encode_utf8 as _str
35
36 # We import these on behalf of other modules.  Silence warning about
37 # these symbols not being used.
38 Python3StringMixIn
39 _str
40
41 class Enum(object):
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)
46
47
48 class NotmuchDatabaseS(Structure):
49     pass
50 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
51
52
53 class NotmuchQueryS(Structure):
54     pass
55 NotmuchQueryP = POINTER(NotmuchQueryS)
56
57
58 class NotmuchThreadsS(Structure):
59     pass
60 NotmuchThreadsP = POINTER(NotmuchThreadsS)
61
62
63 class NotmuchThreadS(Structure):
64     pass
65 NotmuchThreadP = POINTER(NotmuchThreadS)
66
67
68 class NotmuchMessagesS(Structure):
69     pass
70 NotmuchMessagesP = POINTER(NotmuchMessagesS)
71
72
73 class NotmuchMessageS(Structure):
74     pass
75 NotmuchMessageP = POINTER(NotmuchMessageS)
76
77
78 class NotmuchMessagePropertiesS(Structure):
79     pass
80 NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
81
82
83 class NotmuchTagsS(Structure):
84     pass
85 NotmuchTagsP = POINTER(NotmuchTagsS)
86
87
88 class NotmuchDirectoryS(Structure):
89     pass
90 NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
91
92
93 class NotmuchFilenamesS(Structure):
94     pass
95 NotmuchFilenamesP = POINTER(NotmuchFilenamesS)
96
97
98 class NotmuchConfigListS(Structure):
99     pass
100 NotmuchConfigListP = POINTER(NotmuchConfigListS)
101
102
103 class NotmuchIndexoptsS(Structure):
104     pass
105 NotmuchIndexoptsP = POINTER(NotmuchIndexoptsS)