diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index edca658bd4..f4b3966d94 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -133,7 +133,7 @@ test_cli_installer: script: # Tools must be downloaded for testing # We could use "idf_tools.py download all", but we don't want to install clang because of its huge size - - python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa + - python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake - cd ${IDF_PATH}/tools/test_idf_tools - python3 -m pip install jsonschema - python3 ./test_idf_tools.py -v diff --git a/.gitlab/ci/test-win.yml b/.gitlab/ci/test-win.yml index 6949dda5ad..42e2446933 100644 --- a/.gitlab/ci/test-win.yml +++ b/.gitlab/ci/test-win.yml @@ -31,7 +31,7 @@ test_cli_installer_win: IDF_PATH: "$CI_PROJECT_DIR" script: # Tools must be downloaded for testing - - python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa + - python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake - cd ${IDF_PATH}\tools\test_idf_tools - python -m pip install jsonschema - python .\test_idf_tools.py diff --git a/tools/test_idf_tools/test_idf_tools.py b/tools/test_idf_tools/test_idf_tools.py index 09f2d19553..c83df0daa2 100755 --- a/tools/test_idf_tools/test_idf_tools.py +++ b/tools/test_idf_tools/test_idf_tools.py @@ -118,14 +118,17 @@ class TestUsageBase(unittest.TestCase): old_tools_dir = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(idf_tools.IDF_TOOLS_PATH_DEFAULT) mirror_prefix_map = None - if os.path.exists(old_tools_dir): - mirror_prefix_map = 'https://dl.espressif.com/dl/toolchains/preview,file:' + os.path.join(old_tools_dir, - 'dist') - mirror_prefix_map += ';https://dl.espressif.com/dl,file:' + os.path.join(old_tools_dir, 'dist') - mirror_prefix_map += ';https://github.com/espressif/.*/releases/download/.*/,file:' + os.path.join( - old_tools_dir, 'dist', '') + if os.path.exists(old_tools_dir) and sys.platform != 'win32': + # These are are all mapping to filesystem. Windows cannot download from there not even if file:// is omitted + local = ''.join(['file://', os.path.join(old_tools_dir, 'dist', '')]) + + mirror_prefix_map = ';'.join([f'https://dl.espressif.com/dl,{local}', + f'https://github.com/.*/.*/releases/download/.*/,{local}']) + + # Windows will keep downloading the tools from default location or IDF_MIRROR_PREFIX_MAP if set globally + if mirror_prefix_map: - print('Using IDF_MIRROR_PREFIX_MAP={}'.format(mirror_prefix_map)) + print(f'Using IDF_MIRROR_PREFIX_MAP={mirror_prefix_map}') os.environ['IDF_MIRROR_PREFIX_MAP'] = mirror_prefix_map cls.temp_tools_dir = tempfile.mkdtemp(prefix='idf_tools_tmp')