From 37e8b5af8ffc5bc770d29e3078ec4904d2bb9da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20R=2E=20Sede=C3=B1o?= Date: Thu, 23 Sep 2021 12:15:22 -0400 Subject: [PATCH] work on xapian-delve issues 1) `xapian_wheel_builder.sh` adds `xapian-delve` to the wheel 2) `tests/xapian_tests/tests/test_backend.py` learns to check the new `xapian-delve` location 3) drop support for delve from xapian<1.3 (support dropped along Python 2) --- tests/xapian_tests/tests/test_backend.py | 13 +++++++------ xapian_wheel_builder.sh | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/xapian_tests/tests/test_backend.py b/tests/xapian_tests/tests/test_backend.py index d961b59..3d1dd9c 100644 --- a/tests/xapian_tests/tests/test_backend.py +++ b/tests/xapian_tests/tests/test_backend.py @@ -1,5 +1,6 @@ from decimal import Decimal import datetime +import inspect import sys import xapian import subprocess @@ -30,17 +31,17 @@ class XapianSearchResult(SearchResult): def get_terms(backend, *args): - if XAPIAN_VERSION[1] <= 2: - # old versions use "delve". - executable = 'delve' - else: - # new versions use 'xapian-delve' - executable = 'xapian-delve' + executable = 'xapian-delve' # dev versions (odd minor) use a suffix if XAPIAN_VERSION[1] % 2 != 0: executable = executable+'-%d.%d' % tuple(XAPIAN_VERSION[0:2]) + # look for a xapian-delve built by `xapian_wheel_builder` + wheel_delve = os.path.join(os.path.dirname(inspect.getfile(xapian)), executable) + if os.path.exists(wheel_delve): + executable = wheel_delve + result = subprocess.check_output([executable] + list(args) + [backend.path], env=os.environ.copy()).decode('utf-8') result = result.split(": ") diff --git a/xapian_wheel_builder.sh b/xapian_wheel_builder.sh index 2738f57..1b59017 100755 --- a/xapian_wheel_builder.sh +++ b/xapian_wheel_builder.sh @@ -135,8 +135,8 @@ echo "Building xapian python3 bindings..." make install ) -echo "preparing xapian wheel..." -for file in "${prefix}"/xapian/*.so; do +binary_patch_rpath() { + file="${1}" case "${uname_sysname}" in Linux|FreeBSD) # Binary patch rpath to be '$ORIGIN' as needed. @@ -151,6 +151,11 @@ for file in "${prefix}"/xapian/*.so; do install_name_tool -change "${prefix}/lib/${libxapian_name}" "@loader_path/${libxapian_name}" "${file}" ;; esac +} + +echo "preparing xapian wheel..." +for file in "${prefix}"/xapian/*.so; do + binary_patch_rpath "${file}" done # Copy libxapian into place alongside the python bindings. @@ -161,6 +166,11 @@ case "${uname_sysname}" in ;; esac +for file in "${prefix}"/bin/xapian-delve*; do + binary_patch_rpath "${file}" + cp "${file}" "${prefix}/xapian" +done + # Prepare the scaffolding for the wheel cat > "$prefix/setup.py" <