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)

    Profiler.stop('run')
    Profiler.stop('main')
    Profiler.dump_data()

    return retval
dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/tools/maketzjs.py/main/original