36def makeFile(output_file, input_cc_file, include, var_name, input_files):
37 bootstrap_cc_text = open(input_cc_file).
read()
38 bootstrap_cc_text = bootstrap_cc_text.replace(
"{{INCLUDE}}", include)
39 bootstrap_cc_text = bootstrap_cc_text.replace(
"{{VAR_NAME}}", var_name)
40 bootstrap_cc_text = bootstrap_cc_text.replace(
"{{DART_SOURCE}}",
42 open(output_file,
'w').
write(bootstrap_cc_text)
49 parser = OptionParser()
51 "--output", action=
"store", type=
"string", help=
"output file name")
56 help=
"input template file")
58 "--include", action=
"store", type=
"string", help=
"variable name")
60 "--var_name", action=
"store", type=
"string", help=
"variable name")
62 (options, args) = parser.parse_args()
63 if not options.output:
64 sys.stderr.write(
'--output not specified\n')
66 if not len(options.input_cc):
67 sys.stderr.write(
'--input_cc not specified\n')
69 if not len(options.include):
70 sys.stderr.write(
'--include not specified\n')
72 if not len(options.var_name):
73 sys.stderr.write(
'--var_name not specified\n')
76 sys.stderr.write(
'No input files specified\n')
83 if not makeFile(options.output, options.input_cc, options.include,
84 options.var_name, files):
88 except Exception
as inst:
89 sys.stderr.write(
'create_string_literal.py exception\n')
90 sys.stderr.write(str(inst))
91 sys.stderr.write(
'\n')