python-cffi: enable out-of-tree builds
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 22 May 2020 01:03:59 +0000 (21:03 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 30 May 2020 15:42:14 +0000 (12:42 -0300)
This is a simple hack to enable out-of-tree builds, a concern raised
by Tomi in id:m24kzjib9a.fsf@guru.guru-group.fi

This change at least enables "make check" to complete without error,
but I'm sure it could be improved.  I am not expert enough in
setuptools to know how.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Amended by db per id:87d06usa31.fsf@powell.devork.be

configure
test/T391-python-cffi.sh

index 9f910b122c2b2da9c98f15c3baa0a07c88877381..32a836bbdb7bcfb9fdc4ffb535d5df2dddfac767 100755 (executable)
--- a/configure
+++ b/configure
@@ -70,6 +70,14 @@ if [ "$srcdir" != "." ]; then
     mkdir bindings/ruby
     cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
     cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
+
+    # Use the same hack to replicate python-cffi source for
+    # out-of-tree builds (again, not ideal).
+    mkdir bindings/python-cffi
+    cp -a "$srcdir"/bindings/python-cffi/tests \
+       "$srcdir"/bindings/python-cffi/notmuch2 \
+       "$srcdir"/bindings/python-cffi/setup.py \
+       bindings/python-cffi/
 fi
 
 # Set several defaults (optionally specified by the user in
index e4f80dc6544a33483a843c961ca541f5217bd366..f961069b87392e598f5f1f89f343da11cc70c5f5 100755 (executable)
@@ -8,7 +8,7 @@ fi
 
 
 test_begin_subtest "python cffi tests"
-pytest_dir=$NOTMUCH_SRCDIR/bindings/python-cffi/build/stage
+pytest_dir=$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage
 printf "[pytest]\nminversion = 3.0\naddopts = -ra\n" > $pytest_dir/pytest.ini
 test_expect_success "(cd $pytest_dir && ${NOTMUCH_PYTHON} -m pytest --log-file=$TMP_DIRECTORY/test.output)"
 test_done