summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Haslam <jason@scitools.com>2015-06-22 16:28:04 -0600
committerJason Haslam <jason@scitools.com>2015-06-22 16:28:04 -0600
commit5d4473d548ec839ee2c5acc006db682afad0bd15 (patch)
treedefa56c7ea976b18da5181aa7daa00725541376f
parentd3441a03386e0d1766c1a4b79d5fa5098786860f (diff)
downloadninja-5d4473d548ec839ee2c5acc006db682afad0bd15.tar.gz
Fix bootstrap from a source path containing spaces.
-rwxr-xr-xconfigure.py8
1 files 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'),