Exemplo n.º 1
0
def save_board_parameters(bcnf):
    basic_params = [
        "FILESYSTEM", "SKETCH", "CHIP_ID", "PORT", "MAC", "CHIP_ID_SHORT",
        "WIFI_STATION_IP", "VALID_BOARD_ADDRESS", "HTTP_URI", "HTTP_PWD",
        "HTTP_USR", "HTTP_ADDR"
    ]

    changed = False

    # print(json.dumps(odb.EXTRA_BUILD_FLAGS, indent=2))

    transfer_missing_elements(odb.EXTRA_BUILD_FLAGS, odb.dft.EXTRA_BUILD_FLAGS)
    transfer_missing_elements(odb.BOARD_SPECIFIC_VARS,
                              odb.dft.BOARD_SPECIFIC_VARS)

    for bpar_ in basic_params:
        if bcnf.has[bpar_]:
            odb.boards_db[bcnf.CHIP_ID][bpar_] = bcnf[bpar_]
            changed = True

    if changed:
        towrite = EasyDict()
        towrite.boards_db = odb.boards_db
        towrite.EXTRA_BUILD_FLAGS = odb.EXTRA_BUILD_FLAGS
        towrite.BOARD_SPECIFIC_VARS = odb.BOARD_SPECIFIC_VARS
        write_to_db(odb.pth.boards_db, towrite)
Exemplo n.º 2
0
# pylint: disable=I0011,E1129,E0611
from __future__ import absolute_import, division, print_function

import os
from os.path import exists as fexists
from os.path import join as pjoin

from fabric.colors import blue, cyan, green, magenta, red, white, yellow

from utils import EasyDict, RecursiveFormatter, local_hostname

odb = EasyDict()

odb.boards_db = EasyDict()
odb.cache = EasyDict()
odb.run = EasyDict()

odb.env = EasyDict()
odb.env.skip_bad_hosts = True
odb.env.colorize_errors = True
odb.env.combine_stderr = True
odb.env.skip_unknown_tasks = True
odb.env.warn_only = True
odb.env.timeout = 5

odb.pth = EasyDict()
odb.pth.root = os.path.realpath(
    os.path.join(os.path.dirname(__file__), "../.."))
odb.pth.user_db = os.path.join(odb.pth.root, "user_conf_db.json")
odb.pth.boards_db = os.path.join(odb.pth.root, "dev_boards_db.json")
odb.pth.cache_db = os.path.join(odb.pth.root, "cache_gen_db.json")