Ejemplo n.º 1
0
def autobuild_python_scripts(scripts_dir):
    """Calls a list of python scripts required for the build
    
        Args:
            scripts (list(dict)): Dictionary of scripts with their arguments

            Ex.
            scripts[0] = {
                'script_path': 'example_script_1.py',
                'args': [es1_arg1, es1_arg2, es1_arg3]
            }
            scripts[1] = {
                'script_path': 'example_script_2.py',
                'args': [es2_arg1, es2_arg2]
            }
    """

    env = Environment(tools=[])
    script_target_output = 'build/test/output/'
    scripts_source = []
    scripts_target = []

    for script in os.listdir(scripts_dir):
        scripts_source.append(os.path.join(scripts_dir, script))
        scripts_target.append(
            os.path.join(script_target_output, script + '.log'))

    target = env.Command(scripts_target,
                         scripts_source,
                         action=env.Action(run_python_scripts,
                                           "Running python scripts"))
    env.AlwaysBuild(target)
Ejemplo n.º 2
0
def autobuild_python_test(path):
    """Add pytest unit tests to be built as part of build/test/output."""

    env = Environment(tools=[])
    target = env.Command(['build/test/output/pytest.log'], [path],
                         action=env.Action(run_pytest,
                                           "Running python unit tests"))
    env.AlwaysBuild(target)
Ejemplo n.º 3
0
def autobuild_release(family=None):
    """Copy necessary files into build/output so that this component can be used by others

    Args:
        family (ArchitectureGroup): The architecture group that we are targeting.  If not
            provided, it is assumed that we are building in the current directory and the
            module_settings.json file is read to create an ArchitectureGroup
    """

    if family is None:
        family = utilities.get_family('module_settings.json')

    env = Environment(tools=[])
    env['TILE'] = family.tile

    target = env.Command(['#build/output/module_settings.json'],
                         ['#module_settings.json'],
                         action=env.Action(create_release_settings_action,
                                           "Creating release manifest"))
    env.AlwaysBuild(target)

    # Copy over release notes if they exist
    if os.path.exists('RELEASE.md'):
        env.Command(['build/output/RELEASE.md'], ['RELEASE.md'],
                    Copy("$TARGET", "$SOURCE"))

    # Now copy across the build products that are not copied automatically
    copy_include_dirs(family.tile)
    copy_tilebus_definitions(family.tile)
    copy_dependency_docs(family.tile)
    copy_linker_scripts(family.tile)

    # Allow users to specify a hide_dependency_images flag that does not copy over all firmware images
    if not family.tile.settings.get('hide_dependency_images', False):
        copy_dependency_images(family.tile)

    copy_extra_files(family.tile)
    build_python_distribution(family.tile)