summaryrefslogtreecommitdiff
path: root/bsp/xplorer4330/tools/sdk_dist.py
blob: 0a8a3eb0dfdf168945c7e14e8ea7e6bb0b40e6fa (plain)
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
import os


def update_sconscript_path(dist_dir):
    sconscript_path = os.path.join(dist_dir, 'SConscript')
    if not os.path.isfile(sconscript_path):
        return

    with open(sconscript_path, 'r') as f:
        data = f.read()

    data = data.replace("if (d != 'M4' and d != 'M0'):",
                        "if (d != 'M4' and d != 'M0' and d != 'project'):")

    with open(sconscript_path, 'w') as f:
        f.write(data)


def dist_do_building(BSP_ROOT, dist_dir):
    from mkdist import bsp_copy_files

    dist_root = os.path.dirname(dist_dir)
    bsp_root = os.path.dirname(BSP_ROOT)

    for dirname in ['applications', 'drivers', 'libraries']:
        print("=> copy xplorer4330 %s" % dirname)
        bsp_copy_files(os.path.join(bsp_root, dirname), os.path.join(dist_root, dirname))

    update_sconscript_path(dist_dir)