From 9f401c6437bfb2c81b18e56d0aa671956867b0f6 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 31 Jan 2018 22:30:17 +0200 Subject: [PATCH] Only quote colons on build lines. Closes #2961. --- mesonbuild/backend/ninjabackend.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 1057892c6..4ce7dd5b4 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -38,8 +38,12 @@ else: execute_wrapper = '' rmfile_prefix = 'rm -f {} &&' -def ninja_quote(text): - for char in ('$', ' ', ':'): +def ninja_quote(text, is_build_line=False): + if is_build_line: + qcs = ('$', ' ', ':') + else: + qcs = ('$', ' ') + for char in qcs: text = text.replace(char, '$' + char) if '\n' in text: raise MesonException('Ninja does not support newlines in rules. ' @@ -83,13 +87,13 @@ class NinjaBuildElement: def write(self, outfile): self.check_outputs() - line = 'build %s: %s %s' % (' '.join([ninja_quote(i) for i in self.outfilenames]), + line = 'build %s: %s %s' % (' '.join([ninja_quote(i, True) for i in self.outfilenames]), self.rule, - ' '.join([ninja_quote(i) for i in self.infilenames])) + ' '.join([ninja_quote(i, True) for i in self.infilenames])) if len(self.deps) > 0: - line += ' | ' + ' '.join([ninja_quote(x) for x in self.deps]) + line += ' | ' + ' '.join([ninja_quote(x, True) for x in self.deps]) if len(self.orderdeps) > 0: - line += ' || ' + ' '.join([ninja_quote(x) for x in self.orderdeps]) + line += ' || ' + ' '.join([ninja_quote(x, True) for x in self.orderdeps]) line += '\n' # This is the only way I could find to make this work on all # platforms including Windows command shell. Slash is a dir separator