From 630a41eb815e2638b741cdbee42d9bb8509cd0a8 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 2 Aug 2021 13:58:42 -0700 Subject: [PATCH] ninjabackend: use get_subdir() instead of subdir attribute for cython As this works correctly for CustomTarget, CustomTargetIndex, and GeneratedList, but .subdir doesn't work for CustomTargetIndex. --- mesonbuild/backend/ninjabackend.py | 2 +- test cases/cython/2 generated sources/meson.build | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 31d981313..906e896d8 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1608,7 +1608,7 @@ class NinjaBackend(backends.Backend): # TODO: introspection? cython_sources.append(output) else: - generated_sources[ssrc] = mesonlib.File.from_built_file(gen.subdir, ssrc) + generated_sources[ssrc] = mesonlib.File.from_built_file(gen.get_subdir(), ssrc) return static_sources, generated_sources, cython_sources diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build index 89dacfa55..cfe62602d 100644 --- a/test cases/cython/2 generated sources/meson.build +++ b/test cases/cython/2 generated sources/meson.build @@ -26,6 +26,16 @@ test( env : ['PYTHONPATH=' + meson.current_build_dir()] ) +# Test a CustomTargetIndex +cti = custom_target( + 'cti', + input : 'gen.py', + output : 'cti.pyx', + command : [py3, '@INPUT@', '@OUTPUT@'], +) + +cti_ext = py3.extension_module('cti', cti[0], dependencies : py3_dep) + cf = configure_file( input : 'configure.pyx.in', output : 'cf.pyx',