def main(args): parser = optparse.OptionParser( usage="%prog --js=<filename> --css=<filename>", epilog=""" A script to takes all of the javascript and css files that comprise trace-viewer and merges them together into two giant js and css files, taking into account various ordering restrictions between them. """) parser.add_option("--js", dest="js_file", help="Where to place generated javascript file") parser.add_option("--css", dest="css_file", help="Where to place generated css file") options, args = parser.parse_args(args) if not options.js_file and not options.css_file: sys.stderr.write("ERROR: Must specify one of --js=<filename> or " "--css=<filename>\n\n") parser.print_help() return 1 project = trace_viewer_project.TraceViewerProject() load_sequence = tvcm.calc_load_sequence( ['tracing/standalone_timeline_view.js'], project) if options.js_file: with _sopen(options.js_file, 'w') as f: f.write(tvcm.generate_js(load_sequence)) if options.css_file: with _sopen(options.css_file, 'w') as f: f.write(tvcm.generate_css(load_sequence)) return 0
def main(args): parser = optparse.OptionParser(usage="%prog --outdir=<directory>") parser.add_option("--outdir", dest="out_dir", help="Where to place generated content") options, args = parser.parse_args(args) if not options.out_dir: sys.stderr.write("ERROR: Must specify --outdir=<directory>") parser.print_help() return 1 filenames = ["tvcm/__init__.js", "about_tracing/__init__.js"] project = trace_viewer_project.TraceViewerProject() load_sequence = tvcm.calc_load_sequence(filenames, project) olddir = os.getcwd() try: try: result_html = generate_html(options.out_dir, load_sequence) except tvcm.module.DepsException, ex: sys.stderr.write("Error: %s\n\n" % str(ex)) return 255 o = open(os.path.join(options.out_dir, "about_tracing.html"), 'w') o.write(result_html) o.close() result_js = generate_js(options.out_dir, load_sequence) o = open(os.path.join(options.out_dir, "about_tracing.js"), 'w') o.write(result_js) o.close()