示例#1
0
def clone_project(url: str,
                  dst_path: Any = None,
                  recursive: bool = False) -> None:
    """Clones an Mbed project from a remote repository.

    Args:
        url: URL of the repository to clone.
        dst_path: Destination path for the repository.
        recursive: Recursively clone all project dependencies.
    """
    git_data = parse_url(url)
    url = git_data["url"]
    if not dst_path:
        dst_path = pathlib.Path(git_data["dst_path"])

    program = MbedProgram.from_url(url, dst_path, check_mbed_os=False)
    if recursive:
        program.resolve_libraries()
示例#2
0
def import_project(url: str,
                   dst_path: Any = None,
                   recursive: bool = False) -> pathlib.Path:
    """Clones an Mbed project from a remote repository.

    Args:
        url: URL of the repository to clone.
        dst_path: Destination path for the repository.
        recursive: Recursively clone all project dependencies.

    Returns:
        The path the project was cloned to.
    """
    git_data = parse_url(url)
    url = git_data["url"]
    if not dst_path:
        dst_path = pathlib.Path(git_data["dst_path"])

    git_utils.clone(url, dst_path)
    if recursive:
        libs = LibraryReferences(root=dst_path, ignore_paths=["mbed-os"])
        libs.fetch()

    return dst_path
示例#3
0
    def test_creates_url_and_dst_dir_from_name(self):
        name = "mbed-os-example-blows-up-board"
        data = parse_url(name)

        self.assertEqual(data["url"], f"https://github.com/armmbed/{name}")
        self.assertEqual(data["dst_path"], name)
示例#4
0
    def test_creates_valid_dst_dir_from_url(self):
        url = "https://superversioncontrol/superorg/mbed-os-example-numskull"
        data = parse_url(url)

        self.assertEqual(data["url"], url)
        self.assertEqual(data["dst_path"], "mbed-os-example-numskull")
示例#5
0
 def test_creates_valid_dst_dir_from_ssh_url(self):
     url = "git@superversioncontrol:superorg/mbed-os-example-numskull"
     data = parse_url(url)
     assert data["url"] == url
     assert data["dst_path"] == "mbed-os-example-numskull"