diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build index cffddd38e..498e31908 100644 --- a/test cases/cython/2 generated sources/meson.build +++ b/test cases/cython/2 generated sources/meson.build @@ -90,6 +90,11 @@ includestuff_ext = py3.extension_module( dependencies: stuff_pxi_dep ) +simpleinclude_ext = py3.extension_module( + 'simpleinclude', + 'simpleinclude.pyx', +) + subdir('libdir') test( diff --git a/test cases/cython/2 generated sources/simpleinclude.pyx b/test cases/cython/2 generated sources/simpleinclude.pyx new file mode 100644 index 000000000..c110f7517 --- /dev/null +++ b/test cases/cython/2 generated sources/simpleinclude.pyx @@ -0,0 +1 @@ +include "simplestuff.pxi" diff --git a/test cases/cython/2 generated sources/simplestuff.pxi b/test cases/cython/2 generated sources/simplestuff.pxi new file mode 100644 index 000000000..264521651 --- /dev/null +++ b/test cases/cython/2 generated sources/simplestuff.pxi @@ -0,0 +1,2 @@ +def func2(): + print("Hello world") diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index ac60907a5..5f4af3b24 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -859,6 +859,27 @@ class AllPlatformTests(BasePlatformTests): name = "/".join(name) # Glue list into a string self.build(target=name) + def test_build_pyx_depfiles(self): + # building regularly and then touching a depfile dependency should rebuild + testdir = os.path.join("test cases/cython", '2 generated sources') + env = get_fake_env(testdir, self.builddir, self.prefix) + try: + cython = detect_compiler_for(env, "cython", MachineChoice.HOST) + if not version_compare(cython.version, '>=0.29.33'): + raise SkipTest('Cython is too old') + except EnvironmentException: + raise SkipTest("Cython is not installed") + self.init(testdir) + + targets = self.introspect('--targets') + for target in targets: + if target['name'].startswith('simpleinclude'): + name = target['name'] + self.build() + self.utime(os.path.join(testdir, 'simplestuff.pxi')) + self.assertBuildRelinkedOnlyTarget(name) + + def test_internal_include_order(self): if mesonbuild.environment.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ): raise SkipTest('Test does not yet support gcc rsp files on msys2')