aboutsummaryrefslogtreecommitdiff
path: root/unittests
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 /unittests
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 'unittests')
-rw-r--r--unittests/allplatformstests.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 8b78590..351f79d 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -833,6 +833,32 @@ class AllPlatformTests(BasePlatformTests):
self.build(target=('barprog' + exe_suffix))
self.assertPathExists(exe2)
+ def test_build_generated_pyx_directly(self):
+ # Check that the transpile stage also includes
+ # dependencies for the compilation stage as dependencies
+ testdir = os.path.join("test cases/cython", '2 generated sources')
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ try:
+ detect_compiler_for(env, "cython", MachineChoice.HOST)
+ except EnvironmentException:
+ raise SkipTest("Cython is not installed")
+ self.init(testdir)
+ # Need to get the full target name of the pyx.c target
+ # (which is unfortunately not provided by introspection :( )
+ # We'll need to dig into the generated sources
+ targets = self.introspect('--targets')
+ name = None
+ for target in targets:
+ for target_sources in target["target_sources"]:
+ for generated_source in target_sources["generated_sources"]:
+ if "includestuff.pyx.c" in generated_source:
+ name = generated_source
+ break
+ # Split the path (we only want the includestuff.cpython-blahblahblah)
+ name = os.path.normpath(name).split("/")[-2:]
+ name = "/".join(name) # Glue list into a string
+ self.build(target=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')