diff options
| author | Thomas Li <47963215+lithomas1@users.noreply.github.com> | 2022-11-04 18:19:44 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-01-15 16:59:47 -0500 |
| commit | 9b999ddc874cfba34c3d1c67f75aba037389e65f (patch) | |
| tree | 076c7f0175030ff4cff14ef535a1f222d8558d9f /test cases/cython | |
| parent | 58cfd8fc2c6f1ec871f227e99ae4ed06eb95d92d (diff) | |
| download | meson-9b999ddc874cfba34c3d1c67f75aba037389e65f.tar.gz | |
BUG: Fix generated sources not being included as dependencies in cython transpilation
Diffstat (limited to 'test cases/cython')
| -rw-r--r-- | test cases/cython/2 generated sources/includestuff.pyx | 1 | ||||
| -rw-r--r-- | test cases/cython/2 generated sources/meson.build | 20 | ||||
| -rw-r--r-- | test cases/cython/2 generated sources/stuff.pxi.in | 2 |
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 000000000..83f881b33 --- /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 cfe62602d..cffddd38e 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 000000000..6417cbc85 --- /dev/null +++ b/test cases/cython/2 generated sources/stuff.pxi.in @@ -0,0 +1,2 @@ +def func(): + print("Hello world") |
