def _main(blade_path, argv): """The main entry of blade.""" command, options, targets = command_line.parse(argv) setup_console(options) if command == 'new': return run_new_command(blade_path, command, options, targets) ws = workspace.initialize(options) ws.switch_to_root_dir() load_config(options, ws.root_dir()) adjust_config_by_options(config, options) if _check_error_log('config'): return 1 if not targets: targets = ['.'] targets = target_pattern.normalize_list(targets, ws.working_dir()) ws.setup_build_dir() lock_id = ws.lock() try: run_fn = run_subcommand_profile if options.profiling else run_subcommand return run_fn(blade_path, command, options, ws, targets) finally: ws.unlock(lock_id)
def _main(blade_path, argv): """The main entry of blade.""" command, options, targets = command_line.parse(argv) setup_console(options) root_dir, working_dir = get_source_dirs() if root_dir != working_dir: # This message is required by vim quickfix mode if pwd is changed during # the building, DO NOT change the pattern of this message. if options.verbosity != 'quiet': print("Blade: Entering directory `%s'" % root_dir) os.chdir(root_dir) load_config(options, root_dir) adjust_config_by_options(config, options) if _check_error_log('config'): return 1 if not targets: targets = ['.'] targets = target_pattern.normalize_list(targets, working_dir) build_dir = setup_build_dir(options) setup_log(build_dir, options) generate_scm(build_dir) lock_file_fd = lock_workspace(build_dir) try: run_fn = run_subcommand_profile if options.profiling else run_subcommand return run_fn(command, options, targets, blade_path, root_dir, build_dir, working_dir) finally: unlock_workspace(lock_file_fd)
def _main(blade_path, argv): """The main entry of blade.""" command, options, targets = command_line.parse(argv) setup_console(options) global _BLADE_ROOT_DIR global _WORKING_DIR _BLADE_ROOT_DIR, _WORKING_DIR = get_source_dirs() if _BLADE_ROOT_DIR != _WORKING_DIR: # This message is required by vim quickfix mode if pwd is changed during # the building, DO NOT change the pattern of this message. if options.verbosity != 'quiet': print("Blade: Entering directory `%s'" % _BLADE_ROOT_DIR) os.chdir(_BLADE_ROOT_DIR) load_config(options, _BLADE_ROOT_DIR) adjust_config_by_options(config, options) if _check_error_log('config'): return 1 global _TARGETS if not targets: targets = ['.'] targets = target.normalize(targets, _WORKING_DIR) _TARGETS = targets build_dir = setup_build_dir(options) setup_log(build_dir, options) generate_scm(build_dir) lock_file_fd = lock_workspace(build_dir) try: if options.profiling: return run_subcommand_profile(command, options, targets, blade_path, build_dir) return run_subcommand(command, options, targets, blade_path, build_dir) finally: unlock_workspace(lock_file_fd)