1 from ctypes import util, cdll
3 class YAJLImportError(ImportError):
6 def find_yajl(required):
7 so_name = util.find_library('yajl')
9 raise YAJLImportError('YAJL shared object not found.')
10 yajl = cdll.LoadLibrary(so_name)
11 major, rest = divmod(yajl.yajl_version(), 10000)
12 minor, micro = divmod(rest, 100)
14 raise YAJLImportError('YAJL version %s.x required, found %s.%s.%s' % (required, major, minor, micro))