Lines Matching refs:self

33     def __init__(self, output: TextIOWrapper, width: int = 78) -> None:
34 self.output = output
35 self.width = width
37 def newline(self) -> None:
38 self.output.write('\n')
40 def comment(self, text: str) -> None:
41 for line in textwrap.wrap(text, self.width - 2, break_long_words=False,
43 self.output.write('# ' + line + '\n')
46 self,
55 self._line('%s = %s' % (key, value), indent)
57 def pool(self, name: str, depth: int) -> None:
58 self._line('pool %s' % name)
59 self.variable('depth', depth, indent=1)
62 self,
74 self._line('rule %s' % name)
75 self.variable('command', command, indent=1)
77 self.variable('description', description, indent=1)
79 self.variable('depfile', depfile, indent=1)
81 self.variable('generator', '1', indent=1)
83 self.variable('pool', pool, indent=1)
85 self.variable('restat', '1', indent=1)
87 self.variable('rspfile', rspfile, indent=1)
89 self.variable('rspfile_content', rspfile_content, indent=1)
91 self.variable('deps', deps, indent=1)
94 self,
128 self._line('build %s: %s' % (' '.join(out_outputs),
131 self._line(' pool = %s' % pool)
133 self._line(' dyndep = %s' % dyndep)
142 self.variable(key, val, indent=1)
146 def include(self, path: str) -> None:
147 self._line('include %s' % path)
149 def subninja(self, path: str) -> None:
150 self._line('subninja %s' % path)
152 def default(self, paths: Union[str, List[str]]) -> None:
153 self._line('default %s' % ' '.join(as_list(paths)))
155 def _count_dollars_before_index(self, s: str, i: int) -> int:
164 def _line(self, text: str, indent: int = 0) -> None:
165 """Write 'text' word-wrapped at self.width characters."""
167 while len(leading_space) + len(text) > self.width:
172 available_space = self.width - len(leading_space) - len(' $')
177 self._count_dollars_before_index(text, space) % 2 == 0):
186 self._count_dollars_before_index(text, space) % 2 == 0):
192 self.output.write(leading_space + text[0:space] + ' $\n')
198 self.output.write(leading_space + text + '\n')
200 def close(self) -> None:
201 self.output.close()