Meta: Download UCD and CLDR data with fallible download function

This commit is contained in:
Timothy Flynn 2022-01-25 18:38:55 -05:00 committed by Linus Groh
parent e805fce46e
commit c7ef86f5d9
Notes: sideshowbarker 2024-07-17 20:12:47 +09:00

View file

@ -69,14 +69,6 @@ set(CLDR_NUMBERS_PATH "${CLDR_PATH}/${CLDR_NUMBERS_SOURCE}")
set(CLDR_UNITS_SOURCE cldr-units-modern)
set(CLDR_UNITS_PATH "${CLDR_PATH}/${CLDR_UNITS_SOURCE}")
function(download_ucd_file url path)
if (NOT EXISTS "${path}")
get_filename_component(file "${path}" NAME)
message(STATUS "Downloading UCD ${file} from ${url}...")
file(DOWNLOAD "${url}" "${path}" INACTIVITY_TIMEOUT 10)
endif()
endfunction()
function(extract_cldr_file source path)
if(EXISTS "${CLDR_ZIP_PATH}" AND NOT EXISTS "${path}")
message(STATUS "Extracting CLDR ${source} from ${CLDR_ZIP_PATH}...")
@ -91,25 +83,21 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}")
remove_path_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}")
download_ucd_file("${UNICODE_DATA_URL}" "${UNICODE_DATA_PATH}")
download_ucd_file("${SPECIAL_CASING_URL}" "${SPECIAL_CASING_PATH}")
download_ucd_file("${DERIVED_GENERAL_CATEGORY_URL}" "${DERIVED_GENERAL_CATEGORY_PATH}")
download_ucd_file("${PROP_LIST_URL}" "${PROP_LIST_PATH}")
download_ucd_file("${DERIVED_CORE_PROP_URL}" "${DERIVED_CORE_PROP_PATH}")
download_ucd_file("${DERIVED_BINARY_PROP_URL}" "${DERIVED_BINARY_PROP_PATH}")
download_ucd_file("${PROP_ALIAS_URL}" "${PROP_ALIAS_PATH}")
download_ucd_file("${PROP_VALUE_ALIAS_URL}" "${PROP_VALUE_ALIAS_PATH}")
download_ucd_file("${NAME_ALIAS_URL}" "${NAME_ALIAS_PATH}")
download_ucd_file("${SCRIPTS_URL}" "${SCRIPTS_PATH}")
download_ucd_file("${SCRIPT_EXTENSIONS_URL}" "${SCRIPT_EXTENSIONS_PATH}")
download_ucd_file("${EMOJI_DATA_URL}" "${EMOJI_DATA_PATH}")
download_ucd_file("${NORM_PROPS_URL}" "${NORM_PROPS_PATH}")
if (NOT EXISTS "${CLDR_ZIP_PATH}")
message(STATUS "Downloading CLDR database from ${CLDR_ZIP_URL}...")
file(DOWNLOAD "${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}" INACTIVITY_TIMEOUT 10)
endif()
download_file("${UNICODE_DATA_URL}" "${UNICODE_DATA_PATH}")
download_file("${SPECIAL_CASING_URL}" "${SPECIAL_CASING_PATH}")
download_file("${DERIVED_GENERAL_CATEGORY_URL}" "${DERIVED_GENERAL_CATEGORY_PATH}")
download_file("${PROP_LIST_URL}" "${PROP_LIST_PATH}")
download_file("${DERIVED_CORE_PROP_URL}" "${DERIVED_CORE_PROP_PATH}")
download_file("${DERIVED_BINARY_PROP_URL}" "${DERIVED_BINARY_PROP_PATH}")
download_file("${PROP_ALIAS_URL}" "${PROP_ALIAS_PATH}")
download_file("${PROP_VALUE_ALIAS_URL}" "${PROP_VALUE_ALIAS_PATH}")
download_file("${NAME_ALIAS_URL}" "${NAME_ALIAS_PATH}")
download_file("${SCRIPTS_URL}" "${SCRIPTS_PATH}")
download_file("${SCRIPT_EXTENSIONS_URL}" "${SCRIPT_EXTENSIONS_PATH}")
download_file("${EMOJI_DATA_URL}" "${EMOJI_DATA_PATH}")
download_file("${NORM_PROPS_URL}" "${NORM_PROPS_PATH}")
download_file("${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}")
extract_cldr_file("${CLDR_CORE_SOURCE}" "${CLDR_CORE_PATH}")
extract_cldr_file("${CLDR_DATES_SOURCE}" "${CLDR_DATES_PATH}")
extract_cldr_file("${CLDR_LOCALES_SOURCE}" "${CLDR_LOCALES_PATH}")