1
# Copyright (C) 2008 Lemur Consulting Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License along
14
# with this program; if not, write to the Free Software Foundation, Inc.,
15
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
r"""_checkxapian.py: Check the version of xapian used.
18
Raises an ImportError on import if the version used is too old to be used at
22
__docformat__ = "restructuredtext en"
24
# The minimum version of xapian required to work at all.
25
min_xapian_version = (1, 0, 6)
27
# Dictionary of features we can't support do to them being missing from the
28
# available version of xapian.
33
versions = xapian.major_version(), xapian.minor_version(), xapian.revision()
36
if versions < min_xapian_version:
38
Xapian Python bindings installed, but need at least version %d.%d.%d - got %s
39
""".strip() % tuple(list(min_xapian_version) + [xapian.version_string()]))
41
if not hasattr(xapian, 'TermCountMatchSpy'):
42
missing_features['tags'] = 1
43
if not hasattr(xapian, 'CategorySelectMatchSpy'):
44
missing_features['facets'] = 1