From 5d4473d548ec839ee2c5acc006db682afad0bd15 Mon Sep 17 00:00:00 2001 From: Jason Haslam Date: Mon, 22 Jun 2015 16:28:04 -0600 Subject: [PATCH] Fix bootstrap from a source path containing spaces. --- configure.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 27516b4..7413659 100755 --- a/configure.py +++ b/configure.py @@ -156,12 +156,16 @@ class Bootstrap: def _expand_paths(self, paths): """Expand $vars in an array of paths, e.g. from a 'build' block.""" paths = ninja_syntax.as_list(paths) - return ' '.join(map(self._expand, paths)) + return ' '.join(map(self._shell_escape, (map(self._expand, paths)))) def _expand(self, str, local_vars={}): """Expand $vars in a string.""" return ninja_syntax.expand(str, self.vars, local_vars) + def _shell_escape(self, path): + """Quote paths containing spaces.""" + return '"%s"' % path if ' ' in path else path + def _run_command(self, cmdline): """Run a subcommand, quietly. Prints the full command on error.""" try: @@ -420,7 +424,7 @@ objs = [] if platform.supports_ninja_browse(): n.comment('browse_py.h is used to inline browse.py.') n.rule('inline', - command=src('inline.sh') + ' $varname < $in > $out', + command='"%s"' % src('inline.sh') + ' $varname < $in > $out', description='INLINE $out') n.build(built('browse_py.h'), 'inline', src('browse.py'), implicit=src('inline.sh'), -- 2.7.4