import os import shutil import argparse parser = argparse.ArgumentParser() parser.description='please enter two parameters and ...' parser.add_argument("-n", "--name", help="project name", type=str, default="phytium-a32") parser.add_argument("-o", "--output", help="export path", type=str, default="./phytium-a32") args = parser.parse_args() print('=== Exporting Phytium BSP for RT-Studio ====') board_src_path = os.path.abspath(r'../board') librs_src_path = os.path.abspath(r'../libraries') board_dst_path = os.path.abspath(r'./board') librs_dst_path = os.path.abspath(r'./libraries') print(' Copying BSP board from {} to {}'.format(board_src_path, board_dst_path)) print(' Copying BSP libraries from {} to {}'.format(librs_src_path, librs_dst_path)) if os.path.exists(board_dst_path): shutil.rmtree(board_dst_path) if os.path.exists(librs_dst_path): shutil.rmtree(librs_dst_path) shutil.copytree(board_src_path, board_dst_path) shutil.copytree(librs_src_path, librs_dst_path) os.system('scons --dist-ide --project-name={} --project-path={}'.format(args.name, args.output)) if os.path.exists(board_dst_path): shutil.rmtree(board_dst_path) if os.path.exists(librs_dst_path): shutil.rmtree(librs_dst_path)