export_project.py 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
import os
import shutil
import argparse

parser = argparse.ArgumentParser()
parser.description='please enter two parameters <project-name> and <export-path> ...'
parser.add_argument("-n", "--name", help="project name", type=str, default="phytium-a64")
parser.add_argument("-o", "--output", help="export path",  type=str, default="./phytium-a64")
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)