projects
/
platform
/
upstream
/
ninja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
667d16d
)
add escaping function to python module
author
Evan Martin
<martine@danga.com>
Tue, 9 Aug 2011 20:21:21 +0000
(13:21 -0700)
committer
Evan Martin
<martine@danga.com>
Tue, 16 Aug 2011 18:35:56 +0000
(11:35 -0700)
misc/ninja.py
patch
|
blob
|
history
diff --git
a/misc/ninja.py
b/misc/ninja.py
index
abde596
..
7fa4bf1
100644
(file)
--- a/
misc/ninja.py
+++ b/
misc/ninja.py
@@
-84,3
+84,11
@@
class Writer(object):
if isinstance(input, list):
return input
return [input]
+
+
+def escape(string):
+ """Escape a string such that it can be embedded into a Ninja file without
+ further interpretation."""
+ assert '\n' not in string, 'Ninja syntax does not allow newlines'
+ # We only have one special metacharacter: '$'.
+ return string.replace('$', '$$')