diff options
-rw-r--r-- | scripts/cmake/util_functions.cmake | 4 | ||||
-rw-r--r-- | scripts/py/check_update_resources_downloaded.py | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake index ee9eceb..25f9731 100644 --- a/scripts/cmake/util_functions.cmake +++ b/scripts/cmake/util_functions.cmake @@ -196,9 +196,9 @@ function(check_update_public_resources resource_downloaded_dir) string(JOIN "/" FILE_URL ${resource_downloaded_dir}) execute_process( - COMMAND python3 ${CMAKE_SOURCE_DIR}/scripts/py/check_update_resources_downloaded.py + COMMAND python3 ${SCRIPTS_DIR}/py/check_update_resources_downloaded.py --resource_downloaded_dir ${resource_downloaded_dir} - --setup_script_path ${CMAKE_SOURCE_DIR}/set_up_default_resources.py + --setup_script_path ${SCRIPTS_DIR}/../set_up_default_resources.py RESULT_VARIABLE return_code ) if (NOT return_code EQUAL "0") diff --git a/scripts/py/check_update_resources_downloaded.py b/scripts/py/check_update_resources_downloaded.py index 6408f14..c016665 100644 --- a/scripts/py/check_update_resources_downloaded.py +++ b/scripts/py/check_update_resources_downloaded.py @@ -60,13 +60,21 @@ def check_update_resources_downloaded( if __name__ == "__main__": parser = ArgumentParser() parser.add_argument( - "--resource_downloaded_dir", help="Resources downloaded directory.", type=str - ) + "--resource_downloaded_dir", + help="Resources downloaded directory.", + type=str, + required=True) parser.add_argument( - "--setup_script_path", help="Path to set_up_default_resources.py.", type=str - ) + "--setup_script_path", + help="Path to set_up_default_resources.py.", + type=str, + required=True) args = parser.parse_args() + # Check validity of script path + if not os.path.isfile(args.setup_script_path): + raise ValueError(f'Invalid script path: {args.setup_script_path}') + # Check if the repo root directory is a git repository root_file_dir = os.path.dirname(os.path.abspath(args.setup_script_path)) is_git_repo = os.path.exists(os.path.join(root_file_dir, ".git")) |