コード例 #1
0
    def test_list_libraries_called(self, mock_program):
        path = pathlib.Path("somewhere")
        get_known_libs(path)

        mock_program.from_existing.assert_called_once_with(path, False)
        mock_program.from_existing.return_value.list_known_library_dependencies.assert_called(
        )
コード例 #2
0
    def test_list_libraries_gets_known_lib_list(self, mock_libs):
        path = pathlib.Path("somewhere")
        mock_libs().iter_resolved.return_value = ["", ""]

        libs = get_known_libs(path)

        assert libs == ["", ""]
コード例 #3
0
def deploy(path: str, force: bool) -> None:
    """Checks out Mbed program library dependencies at the revision specified in the ".lib" files.

    Ensures all dependencies are resolved and the versions are synchronised to the version specified in the library
    reference.

    PATH: Path to the Mbed project [default: CWD]
    """
    click.echo(
        "Checking out all libraries to revisions specified in .lib files. Resolving any unresolved libraries."
    )
    root_path = pathlib.Path(path)
    deploy_project(root_path, force)
    libs = get_known_libs(root_path)
    _print_dependency_table(libs)
コード例 #4
0
def import_(url: str, path: Any, skip_resolve_libs: bool) -> None:
    """Clone an Mbed project and library dependencies.

    URL: The git url of the remote project to clone.

    PATH: Destination path for the clone. If not given the destination path is set to the project name in the cwd.
    """
    click.echo(f"Cloning Mbed program '{url}'")
    if not skip_resolve_libs:
        click.echo("Resolving program library dependencies.")

    if path:
        click.echo(f"Destination path is '{path}'")
        path = pathlib.Path(path)

    dst_path = import_project(url, path, not skip_resolve_libs)
    if not skip_resolve_libs:
        libs = get_known_libs(dst_path)
        _print_dependency_table(libs)
コード例 #5
0
def libs(path: str) -> None:
    """List all resolved library dependencies.

    PATH: Path to the Mbed project [default: CWD]
    """
    lib_data = get_known_libs(pathlib.Path(path))
    click.echo("This program has the following library dependencies: \n")
    table = []
    for lib in sorted(lib_data["known_libs"]):
        table.append([
            lib.reference_file.stem,
            lib.get_git_reference().repo_url,
            lib.get_git_reference().ref
        ])

    headers = ("Library Name", "Repository URL", "Git reference")
    click.echo(tabulate.tabulate(table, headers=headers))

    if lib_data["unresolved"]:
        click.echo(
            "\nUnresolved libraries detected. Please run the `checkout` command to download library source code."
        )