コード例 #1
0
def filter_for_os(archive_candidates: List[MetadataItem], os_type: str) -> List[MetadataItem]:
    filtered_exactly = [
        candidate for candidate in archive_candidates if candidate.os_type == os_type
    ]
    if filtered_exactly:
        return filtered_exactly
    return [
        candidate for candidate in archive_candidates
        if is_compatible_os(candidate.os_type, os_type)
    ]
コード例 #2
0
ファイル: llvm_urls.py プロジェクト: wwjiang007/yugabyte-db
def get_llvm_url(compiler_type: str) -> Optional[str]:
    os_type_to_llvm_url = (
        COMPILER_TYPE_TO_ARCH_TO_OS_TYPE_TO_LLVM_URL.get(compiler_type)
        or {}).get(local_sys_conf().architecture)
    if os_type_to_llvm_url is None:
        return None

    os_type = local_sys_conf().short_os_name_and_version()
    if os_type in os_type_to_llvm_url:
        return os_type_to_llvm_url[os_type]

    candidate_urls = [
        os_type_to_llvm_url[os_type_key] for os_type_key in os_type_to_llvm_url
        if is_compatible_os(os_type_key, os_type)
    ]
    if len(candidate_urls) > 1:
        raise ValueError("Ambiguous LLVM URLs: %s" % candidate_urls)
    if not candidate_urls:
        return None
    candidate_url = candidate_urls[0]
    return candidate_url