summaryrefslogtreecommitdiff
path: root/tools/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/setup.py')
-rwxr-xr-xtools/setup.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/setup.py b/tools/setup.py
index 1f065769a..1a0b491c0 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -54,6 +54,18 @@ gn_args_header = [
]
+def gn_string(s):
+ # In gn, strings are enclosed in double-quotes and use backslash as the
+ # escape character. The only escape sequences supported are:
+ # \" (for literal quote)
+ # \$ (for literal dollars sign)
+ # \\ (for literal backslash)
+ # Any other use of a backslash is treated as a literal backslash.
+ s = re.sub(r'("|\$|\\(?=["$\\]))', r'\\\1', s)
+ s = '"' + s + '"'
+ return s
+
+
def gn_args_are_generated(lines):
for line in lines:
if re.match("^\s*#.*REMOVE THIS LINE", line):