aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorThomas Li <47963215+lithomas1@users.noreply.github.com>2022-11-04 18:19:44 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-01-15 16:59:47 -0500
commit9b999ddc874cfba34c3d1c67f75aba037389e65f (patch)
tree076c7f0175030ff4cff14ef535a1f222d8558d9f /test cases
parent58cfd8fc2c6f1ec871f227e99ae4ed06eb95d92d (diff)
downloadmeson-9b999ddc874cfba34c3d1c67f75aba037389e65f.zip
meson-9b999ddc874cfba34c3d1c67f75aba037389e65f.tar.gz
meson-9b999ddc874cfba34c3d1c67f75aba037389e65f.tar.bz2
BUG: Fix generated sources not being included as dependencies in cython transpilation
Diffstat (limited to 'test cases')
-rw-r--r--test cases/cython/2 generated sources/includestuff.pyx1
-rw-r--r--test cases/cython/2 generated sources/meson.build20
-rw-r--r--test cases/cython/2 generated sources/stuff.pxi.in2
3 files changed, 23 insertions, 0 deletions
diff --git a/test cases/cython/2 generated sources/includestuff.pyx b/test cases/cython/2 generated sources/includestuff.pyx
new file mode 100644
index 0000000..83f881b
--- /dev/null
+++ b/test cases/cython/2 generated sources/includestuff.pyx
@@ -0,0 +1 @@
+include "stuff.pxi"
diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build
index cfe6260..cffddd3 100644
--- a/test cases/cython/2 generated sources/meson.build
+++ b/test cases/cython/2 generated sources/meson.build
@@ -6,6 +6,7 @@ project(
py_mod = import('python')
py3 = py_mod.find_installation('python3')
py3_dep = py3.dependency(required : false)
+fs = import('fs')
if not py3_dep.found()
error('MESON_SKIP_TEST: Python library not found.')
endif
@@ -70,6 +71,25 @@ test(
env : ['PYTHONPATH=' + meson.current_build_dir()]
)
+stuff_pxi = fs.copyfile(
+ 'stuff.pxi.in',
+ 'stuff.pxi'
+)
+
+# Need to copy the cython source to the build directory
+# since meson can only generate the .pxi there
+includestuff_pyx = fs.copyfile(
+ 'includestuff.pyx'
+)
+
+stuff_pxi_dep = declare_dependency(sources: stuff_pxi)
+
+includestuff_ext = py3.extension_module(
+ 'includestuff',
+ includestuff_pyx,
+ dependencies: stuff_pxi_dep
+)
+
subdir('libdir')
test(
diff --git a/test cases/cython/2 generated sources/stuff.pxi.in b/test cases/cython/2 generated sources/stuff.pxi.in
new file mode 100644
index 0000000..6417cbc
--- /dev/null
+++ b/test cases/cython/2 generated sources/stuff.pxi.in
@@ -0,0 +1,2 @@
+def func():
+ print("Hello world")