From e7819c5d2986c28ae718d7491d878610405fc7db Mon Sep 17 00:00:00 2001 From: Huaqi Fang <578567190@qq.com> Date: Thu, 4 Jan 2024 11:15:54 +0800 Subject: [PATCH] ci: force reinstall gd openocd if --force passed Signed-off-by: Huaqi Fang <578567190@qq.com> --- .github/prepare_tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/prepare_tools.py b/.github/prepare_tools.py index 0018482..0bc2124 100644 --- a/.github/prepare_tools.py +++ b/.github/prepare_tools.py @@ -172,7 +172,10 @@ def setup_gd_openocd(toolsdir, gd_openocd_uri, system_value, nsideloc, reuse, fo print("This %s may not be a valid openocd package!" % (org_folder)) sys.exit(1) # Rename the old openocd folder to gd_openocd - if os.path.isdir(destination_folder) == False: + if os.path.isdir(destination_folder) == False or force == True: + if force == True and os.path.isdir(destination_folder): + print("Remove existing %s" % (destination_folder)) + shutil.rmtree(destination_folder) print("Copy %s -> %s" % (org_folder, destination_folder)) shutil.copytree(org_folder, destination_folder) else: