aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-12-01 00:27:51 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-02-10 02:15:35 -0500
commit6ea24ee9e29a03c42665be8f1ec2f9c635fb985a (patch)
treedfcc9acd6b6c801d5a69720ff3c07fdb6dbe7224 /mesonbuild
parenta846fa3352cd6353c50cb6c46e7782110423d646 (diff)
downloadmeson-6ea24ee9e29a03c42665be8f1ec2f9c635fb985a.zip
meson-6ea24ee9e29a03c42665be8f1ec2f9c635fb985a.tar.gz
meson-6ea24ee9e29a03c42665be8f1ec2f9c635fb985a.tar.bz2
backends: handle cython ninja rules a bit more idiomatically
We want to use as much default ninja behavior as we can, so reuse $out instead of repeating the output file as a string in $ARGS, and raise that into the build rule so it is only listed once.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 5722cbb..619bf7c 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1703,8 +1703,6 @@ class NinjaBackend(backends.Backend):
for src in target.get_sources():
if src.endswith('.pyx'):
output = os.path.join(self.get_target_private_dir(target), f'{src}.{ext}')
- args = args.copy()
- args += cython.get_output_args(output)
element = NinjaBuildElement(
self.all_outputs, [output],
self.compiler_to_rule_name(cython),
@@ -1725,9 +1723,7 @@ class NinjaBackend(backends.Backend):
else:
ssrc = os.path.join(gen.get_subdir(), ssrc)
if ssrc.endswith('.pyx'):
- args = args.copy()
output = os.path.join(self.get_target_private_dir(target), f'{ssrc}.{ext}')
- args += cython.get_output_args(output)
element = NinjaBuildElement(
self.all_outputs, [output],
self.compiler_to_rule_name(cython),
@@ -2235,9 +2231,14 @@ class NinjaBackend(backends.Backend):
def generate_cython_compile_rules(self, compiler: 'Compiler') -> None:
rule = self.compiler_to_rule_name(compiler)
- command = compiler.get_exelist() + ['$ARGS', '$in']
description = 'Compiling Cython source $in'
- self.add_rule(NinjaRule(rule, command, [], description, extra='restat = 1'))
+ command = compiler.get_exelist()
+
+ args = ['$ARGS', '$in']
+ args += NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none)
+ self.add_rule(NinjaRule(rule, command + args, [],
+ description,
+ extra='restat = 1'))
def generate_rust_compile_rules(self, compiler):
rule = self.compiler_to_rule_name(compiler)