Beispiel #1
0
def get_specfile_path_from_repo(project: GitProject) -> Optional[str]:
    """
    Get the path of the spec file in the given repo if present.
    :param project: GitProject
    :return: str path of the spec file or None
    """
    spec_files = project.get_files(filter_regex=r".+\.spec$")
    if not spec_files:
        logger.debug(f"No spec file found in {project.full_repo_name}")
        return None
    return spec_files[0]
Beispiel #2
0
def get_specfile_path_from_repo(project: GitProject):
    """
    Get the path of the spec file in the given repo if present.
    :param project: GitProject
    :return: str path of the spec file
    """
    try:
        return project.get_files(filter_regex=".*.spec")[0]
    except Exception as ex:
        logger.debug(f"Cannot find the spec file: {ex}")
        return None
Beispiel #3
0
def get_specfile_path_from_repo(project: GitProject, ref: str = None) -> Optional[str]:
    """
    Get the path of the spec file in the given repo if present.
    :param project: GitProject
    :param ref: git ref (defaults to repo's default branch)
    :return: str path of the spec file or None
    """
    spec_files = project.get_files(ref=ref, filter_regex=r".+\.spec$")

    if not spec_files:
        logger.debug(f"No spec file found in {project.full_repo_name!r}")
        return None
    return spec_files[0]