From 5e51c526a17b4f2c34e1bcc9d2809ac3f1f200c1 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Tue, 1 Jan 2013 23:43:25 +0200 Subject: Moved quoting function. --- environment.py | 3 --- shellgenerator.py | 7 +++++-- test cases/1 trivial/builder.txt | 1 + test cases/1 trivial/trivial.c | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 test cases/1 trivial/trivial.c diff --git a/environment.py b/environment.py index 097ba1f..dabb74e 100755 --- a/environment.py +++ b/environment.py @@ -78,9 +78,6 @@ class GnuCCompiler(CCompiler): def get_std_opt_flags(self): return GnuCCompiler.std_opt_flags -def shell_quote(cmdlist): - return ["'" + x + "'" for x in cmdlist] - class Environment(): def __init__(self, source_dir, build_dir): self.source_dir = source_dir diff --git a/shellgenerator.py b/shellgenerator.py index 49267f3..4ce023f 100755 --- a/shellgenerator.py +++ b/shellgenerator.py @@ -16,6 +16,9 @@ import os, stat +def shell_quote(cmdlist): + return ["'" + x + "'" for x in cmdlist] + class ShellGenerator(): def __init__(self, interpreter, environment): @@ -57,7 +60,7 @@ class ShellGenerator(): commands.append(abs_src) commands += compiler.get_output_flags() commands.append(abs_obj) - quoted = environment.shell_quote(commands) + quoted = shell_quote(commands) outfile.write('\necho Compiling \\"%s\\"\n' % src) outfile.write(' '.join(quoted) + ' || exit\n') return abs_obj @@ -71,7 +74,7 @@ class ShellGenerator(): commands += dep.get_link_flags() commands += linker.get_output_flags() commands.append(outname) - quoted = environment.shell_quote(commands) + quoted = shell_quote(commands) outfile.write('\necho Linking \\"%s\\".\n' % outname) outfile.write(' '.join(quoted) + ' || exit\n') diff --git a/test cases/1 trivial/builder.txt b/test cases/1 trivial/builder.txt index fdd1c62..0ab3f5d 100644 --- a/test cases/1 trivial/builder.txt +++ b/test cases/1 trivial/builder.txt @@ -1,3 +1,4 @@ project('trivial test') language('c') +exe = executable('trivialprog', 'trivial.c') diff --git a/test cases/1 trivial/trivial.c b/test cases/1 trivial/trivial.c new file mode 100644 index 0000000..363dac3 --- /dev/null +++ b/test cases/1 trivial/trivial.c @@ -0,0 +1,3 @@ +int main(int argv, char **argv) { + return 0; +} -- cgit v1.1