def main(): (options, args, parser) = simple_options(_parser, __version__, __dependencies__) Profiler.start('main') Profiler.start('startup') # Sanity checks if 0 == len(args): LOG.error("no input files specified") parser.print_help() exit(1) if options.mode not in [ 'plugin', 'canvas', 'webworker', 'webworker-debug' ]: LOG.error("invalid mode %s", options.mode) parser.print_help() exit(1) if options.output is None: LOG.error("no output file specified (required in dependency mode)") parser.print_help() exit(1) # Create a jinja2 env env = env_create(options) input_js = args LOG.info("input files: %s", input_js) Profiler.stop('startup') Profiler.start('run') # Execute retval = 1 try: if options.dependency: LOG.info("dependency generation selected") retval = tzjs_dump_dependencies(env, options, input_js) else: LOG.info("rendering tzjs") retval = tzjs_generate(env, options, input_js) except ToolsException, e: LOG.error(str(e)) exit(1)
def main(): (options, args, parser) = simple_options(_parser, __version__, __dependencies__) Profiler.start('main') Profiler.start('startup') # Sanity checks if 0 == len(args): LOG.error("no input files specified") parser.print_help() exit(1) if options.mode not in [ 'plugin', 'canvas' ]: LOG.error("invalid mode %s" % options.mode) parser.print_help() exit(1) if options.output is None: LOG.error("no output file specified (required in dependency mode)") parser.print_help() exit(1) # Create a jinja2 env env = env_create(options) input_js = args LOG.info("input files: %s" % input_js) Profiler.stop('startup') Profiler.start('run') # Execute retval = 1 try: if options.dependency: LOG.info("dependency generation selected") retval = tzjs_dump_dependencies(env, options, input_js) else: LOG.info("rendering tzjs") retval = tzjs_generate(env, options, input_js) except ToolsException, e: LOG.error(str(e)) exit(1)
def main(): (options, args, parser) = simple_options(_parser, __version__, __dependencies__, input_required=False) Profiler.start('main') Profiler.start('startup') input_files = args # Check that if dump-default-template is set then output and exit if options.dump_default_template: exit(dump_default_template(options.output)) elif 0 == len(args): LOG.error('No input files specified') parser.print_help() exit(1) LOG.info("options: %s" % options) LOG.info("args: %s" % args) LOG.info("parser: %s" % parser) LOG.info("templatedirs: %s" % options.templatedirs) if options.output is None: LOG.error("no output file specified (required in dependency mode)") parser.print_help() exit(1) # Check mode if options.mode not in [ 'plugin-debug', 'plugin', 'canvas-debug', 'canvas' ]: LOG.error('Unrecognised mode: %s' % options.mode) parser.print_help() exit(1) # Check a release source name is given if mode is one of release # or canvas if options.mode in [ 'plugin', 'canvas' ] and \ not options.dependency and \ not options.codefile: LOG.error('Missing code file name. Use --code to specify.') parser.print_usage() exit(1) # Check input files and split them into (ordered) js and html (input_js, input_html) = check_input(input_files) LOG.info("js files: %s" % input_js) LOG.info("html files: %s" % input_html) # In debug and canvas-debug we need a .js input file if 0 == len(input_js): if options.mode in [ 'debug', 'canvas-debug' ]: LOG.error('Missing input .js file') parser.print_usage() exit(1) if 1 < len(input_html): LOG.error('Multiple html files specified: %s' % input_html) exit(1) # Create a jinja2 env env = env_create(options, DEFAULT_HTML_TEMPLATE) Profiler.stop('startup') Profiler.start('run') # Execute retval = 1 try: if options.dependency: LOG.info("generating dependencies") retval = html_dump_dependencies(env, options, input_js, input_html) LOG.info("done generating dependencies") else: retval = html_generate(env, options, input_js, input_html) except ToolsException, e: #traceback.print_exc() LOG.error("%s" % str(e))
def main(): (options, args, parser) = simple_options(_parser, __version__, __dependencies__, input_required=False) Profiler.start('main') Profiler.start('startup') input_files = args # Check that if dump-default-template is set then output and exit if options.dump_default_template: exit(dump_default_template(options.output)) elif 0 == len(args): LOG.error('No input files specified') parser.print_help() exit(1) LOG.info("options: %s", options) LOG.info("args: %s", args) LOG.info("parser: %s", parser) LOG.info("templatedirs: %s", options.templatedirs) if options.output is None: LOG.error("no output file specified (required in dependency mode)") parser.print_help() exit(1) # Check mode if options.mode not in [ 'plugin-debug', 'plugin', 'canvas-debug', 'canvas' ]: LOG.error('Unrecognised mode: %s', options.mode) parser.print_help() exit(1) # Check a release source name is given if mode is one of release # or canvas if options.mode in [ 'plugin', 'canvas' ] and \ not options.dependency and \ not options.codefile: LOG.error('Missing code file name. Use --code to specify.') parser.print_usage() exit(1) # Check input files and split them into (ordered) js and html (input_js, input_html) = check_input(input_files) LOG.info("js files: %s", input_js) LOG.info("html files: %s", input_html) # In debug and canvas-debug we need a .js input file if 0 == len(input_js): if options.mode in ['debug', 'canvas-debug']: LOG.error('Missing input .js file') parser.print_usage() exit(1) if 1 < len(input_html): LOG.error('Multiple html files specified: %s', input_html) exit(1) # Create a jinja2 env env = env_create(options, DEFAULT_HTML_TEMPLATE) Profiler.stop('startup') Profiler.start('run') # Execute retval = 1 try: if options.dependency: LOG.info("generating dependencies") retval = html_dump_dependencies(env, options, input_js, input_html) LOG.info("done generating dependencies") else: retval = html_generate(env, options, input_js, input_html) except ToolsException, e: #traceback.print_exc() LOG.error("%s", str(e))