Give more information on how to install Cython through the package manager.
[invirt/packages/python-afs.git] / afs / afs.pyx
1 """
2 General PyAFS utilities, such as error handling
3 """
4
5 import sys
6
7 cdef int _init = 0
8
9 class AFSException(Exception):
10     def __init__(self, errno):
11         self.errno = errno
12         self.strerror = afs_error_message(errno)
13
14     def __repr__(self):
15         return "AFSException(%s)" % (self.errno)
16
17     def __str__(self):
18         return "[%s] %s" % (self.errno, self.strerror)
19
20 def pyafs_error(code):
21     if not _init:
22         initialize_ACFG_error_table()
23         initialize_KTC_error_table()
24         initialize_PT_error_table()
25         initialize_RXK_error_table()
26         initialize_U_error_table()
27
28         _init = 1
29
30     if code != 0:
31         raise AFSException(code)