def dependency_list():
    dependency_list = DependencyList()
    dependency_list.dependencies = [
        Dependency(name="My dep 1", url="http://example.com/dep1"),
        Dependency(name="My dep 2", url="http://example.com/dep2"),
    ]

    return dependency_list
Exemple #2
0
 def create_dependencies(self, path: Path):
     """Set dependencies from config file in given path."""
     config = get_config(path)
     check_config(config)
     self.dependencies = [
         Dependency(**kwargs) for kwargs in config["dependencies"]
     ]
def dependency():
    return Dependency(
        name="My dep",
        url="http://example.com/dependency",
        git_hash="424242",
        cmake_args="-DCMAKE_ARG=ON",
        jobs=1,
    )
def dependency_list_data():
    dependency_list = DependencyList()
    dependency_list.dependencies = [
        Dependency(
            name="My dep 1",
            url="http://example.com/dep1",
            cmake_project_name="Dep1",
            cmake_project_version=version.parse("1.2.0"),
        ),
        Dependency(
            name="My dep 1",
            url="http://example.com/dep2",
            cmake_project_name="Dep2",
            cmake_project_version=version.parse("2.4.0"),
        ),
    ]

    return dependency_list
 def test_create(self):
     """Create a dependency."""
     dependency = Dependency(
         name="My dep",
         url="http://example.com/dependency",
         git_hash="424242",
         cmake_args="-DCMAKE_ARG=ON",
     )
     assert dependency.name == "My dep"
     assert dependency.url == "http://example.com/dependency"
     assert dependency.git_hash == "424242"
     assert dependency.cmake_args == "-DCMAKE_ARG=ON"
Exemple #6
0
    def generate_subdependencies(self) -> Iterator[Dependency]:
        """Generate dependencies recursively.

        The iterator explores file system for config files to get the
        subdependencies. Dependencies must have been fetched beforehand.
        """
        # generate the dependencies list in revers order
        self.dependencies.reverse()
        i = 0
        while i != len(self.dependencies):
            dependency = self.dependencies[i]
            # load config file if any or move to next dependency
            try:
                dependency_config = get_config(CACHE_FETCH /
                                               dependency.directory_name)

            except ConfigNotFoundError:
                i += 1
                continue

            check_config(dependency_config)

            # create subdependendencies from dependency config
            subdependencies = [
                Dependency(**kwargs, parent=dependency)
                for kwargs in dependency_config["dependencies"]
            ]
            subdependencies.reverse()
            # add supdependencies to the dependency list
            # they will be listed before the parent dependency
            self.dependencies[i + 1:i + 1] = subdependencies
            for subdependency in subdependencies:
                yield subdependency

            i += 1

        self.dependencies.reverse()
 def test_create_partial_arguments(self):
     """Create a dependency with partial arguments."""
     dependency = Dependency(name="My dep", url="http://example.com/dependency")
     assert dependency.git_hash == ""
     assert dependency.cmake_args == ""
def local_zip_dependency():
    return Dependency(
        name="My zip dep",
        url="file:///home/me/dependency.zip",
    )
def folder_dependency():
    return Dependency(
        name="My dep",
        url="file:///home/me/dependency",
    )
def zip_dependency():
    return Dependency(
        name="My zip dep",
        url="http://example.com/dependency.zip",
    )
def git_dependency():
    return Dependency(
        name="My Git dep",
        url="http://example.com/dependency.git",
        git_hash="424242",
    )
def subdir_dependency():
    return Dependency(
        name="My dep", url="http://example.com/dependency", cmake_subdir="subdir"
    )
 def test_create_too_few_arguments(self):
     """Create a dependency with to few arguments."""
     with pytest.raises(TypeError):
         Dependency(name="My dep")