]> git.notmuchmail.org Git - notmuch/blob - bindings/python/notmuch/globals.py
python: bump SONAME
[notmuch] / 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 <http://www.gnu.org/licenses/>.
16
17 Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
18 """
19
20 from ctypes import CDLL, Structure, POINTER
21
22 #-----------------------------------------------------------------------------
23 #package-global instance of the notmuch library
24 try:
25     from os import uname
26     if uname()[0] == 'Darwin':
27         nmlib = CDLL("libnotmuch.4.dylib")
28     else:
29         nmlib = CDLL("libnotmuch.so.4")
30 except:
31     raise ImportError("Could not find shared 'notmuch' library.")
32
33 from .compat import Python3StringMixIn, encode_utf8 as _str
34
35 class Enum(object):
36     """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
37     def __init__(self, names):
38         for number, name in enumerate(names):
39             setattr(self, name, number)
40
41
42 class NotmuchDatabaseS(Structure):
43     pass
44 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
45
46
47 class NotmuchQueryS(Structure):
48     pass
49 NotmuchQueryP = POINTER(NotmuchQueryS)
50
51
52 class NotmuchThreadsS(Structure):
53     pass
54 NotmuchThreadsP = POINTER(NotmuchThreadsS)
55
56
57 class NotmuchThreadS(Structure):
58     pass
59 NotmuchThreadP = POINTER(NotmuchThreadS)
60
61
62 class NotmuchMessagesS(Structure):
63     pass
64 NotmuchMessagesP = POINTER(NotmuchMessagesS)
65
66
67 class NotmuchMessageS(Structure):
68     pass
69 NotmuchMessageP = POINTER(NotmuchMessageS)
70
71
72 class NotmuchTagsS(Structure):
73     pass
74 NotmuchTagsP = POINTER(NotmuchTagsS)
75
76
77 class NotmuchDirectoryS(Structure):
78     pass
79 NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
80
81
82 class NotmuchFilenamesS(Structure):
83     pass
84 NotmuchFilenamesP = POINTER(NotmuchFilenamesS)