summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorChris Drake <cjdrake@gmail.com>2014-05-05 01:34:55 (GMT)
committerChris Drake <cjdrake@gmail.com>2014-05-05 02:55:02 (GMT)
commitc5ee738460d6b4ef4657c1ca5f1da5c5be4d05bb (patch)
treee303bfa0755ec9f5d662e012c6ef5d0d357c12ea /misc
parent9b156e4e026bfad25bb2684d2f4fb8862ec19752 (diff)
downloadNinja-c5ee738460d6b4ef4657c1ca5f1da5c5be4d05bb.zip
Ninja-c5ee738460d6b4ef4657c1ca5f1da5c5be4d05bb.tar.gz
Ninja-c5ee738460d6b4ef4657c1ca5f1da5c5be4d05bb.tar.bz2
Use consistent indentation conventions
Diffstat (limited to 'misc')
-rw-r--r--misc/ninja_syntax.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py
index 4b9b547..32dbefb 100644
--- a/misc/ninja_syntax.py
+++ b/misc/ninja_syntax.py
@@ -11,7 +11,7 @@ import textwrap
import re
def escape_path(word):
- return word.replace('$ ','$$ ').replace(' ','$ ').replace(':', '$:')
+ return word.replace('$ ', '$$ ').replace(' ', '$ ').replace(':', '$:')
class Writer(object):
def __init__(self, output, width=78):
@@ -74,7 +74,7 @@ class Writer(object):
all_inputs.extend(order_only)
self._line('build %s: %s' % (' '.join(out_outputs),
- ' '.join([rule] + all_inputs)))
+ ' '.join([rule] + all_inputs)))
if variables:
if isinstance(variables, dict):
@@ -97,13 +97,13 @@ class Writer(object):
self._line('default %s' % ' '.join(self._as_list(paths)))
def _count_dollars_before_index(self, s, i):
- """Returns the number of '$' characters right in front of s[i]."""
- dollar_count = 0
- dollar_index = i - 1
- while dollar_index > 0 and s[dollar_index] == '$':
- dollar_count += 1
- dollar_index -= 1
- return dollar_count
+ """Returns the number of '$' characters right in front of s[i]."""
+ dollar_count = 0
+ dollar_index = i - 1
+ while dollar_index > 0 and s[dollar_index] == '$':
+ dollar_count += 1
+ dollar_index -= 1
+ return dollar_count
def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
@@ -116,19 +116,19 @@ class Writer(object):
available_space = self.width - len(leading_space) - len(' $')
space = available_space
while True:
- space = text.rfind(' ', 0, space)
- if space < 0 or \
- self._count_dollars_before_index(text, space) % 2 == 0:
- break
+ space = text.rfind(' ', 0, space)
+ if (space < 0 or
+ self._count_dollars_before_index(text, space) % 2 == 0):
+ break
if space < 0:
# No such space; just use the first unescaped space we can find.
space = available_space - 1
while True:
- space = text.find(' ', space + 1)
- if space < 0 or \
- self._count_dollars_before_index(text, space) % 2 == 0:
- break
+ space = text.find(' ', space + 1)
+ if (space < 0 or
+ self._count_dollars_before_index(text, space) % 2 == 0):
+ break
if space < 0:
# Give up on breaking.
break