Revision 19bf7c87 scripts/qapi-types.py
b/scripts/qapi-types.py | ||
---|---|---|
183 | 183 |
elif o in ("-o", "--output-dir"): |
184 | 184 |
output_dir = a + "/" |
185 | 185 |
elif o in ("-c", "--source"): |
186 |
do_h = True |
|
187 |
elif o in ("-h", "--header"): |
|
188 | 186 |
do_c = True |
187 |
elif o in ("-h", "--header"): |
|
188 |
do_h = True |
|
189 | 189 |
|
190 | 190 |
if not do_c and not do_h: |
191 | 191 |
do_c = True |
... | ... | |
201 | 201 |
raise |
202 | 202 |
|
203 | 203 |
def maybe_open(really, name, opt): |
204 |
class Null(object): |
|
205 |
def write(self, str): |
|
206 |
pass |
|
207 |
def read(self): |
|
208 |
return '' |
|
209 | 204 |
if really: |
210 | 205 |
return open(name, opt) |
206 |
else: |
|
207 |
import StringIO |
|
208 |
return StringIO.StringIO() |
|
211 | 209 |
|
212 | 210 |
fdef = maybe_open(do_c, c_file, 'w') |
213 | 211 |
fdecl = maybe_open(do_h, h_file, 'w') |
Also available in: Unified diff