diff --git a/.flake8 b/.flake8 index b67d9c2198..4a0ec27194 100644 --- a/.flake8 +++ b/.flake8 @@ -19,5 +19,5 @@ exclude = ./node ./python ./temp - ./zips + ./downloads ./crunch diff --git a/.gitignore b/.gitignore index 0d794d22d0..d181c30d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ __pycache__ /node /python /temp -/zips +/downloads /crunch /java /mingw diff --git a/emsdk.py b/emsdk.py index 09518dff70..57f4d41b2b 100644 --- a/emsdk.py +++ b/emsdk.py @@ -51,7 +51,7 @@ # `main.zip` perhaps. emsdk_zip_download_url = 'https://github.com/emscripten-core/emsdk/archive/HEAD.zip' -zips_subdir = 'zips/' +download_dir = 'downloads/' extra_release_tag = None @@ -1407,13 +1407,13 @@ def build_binaryen_tool(tool): return success -def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True): - debug_print('download_and_unzip(zipfile=' + zipfile + ', dest_dir=' + dest_dir + ')') +def download_and_extract(archive, dest_dir, filename_prefix='', clobber=True): + debug_print('download_and_extract(archive=' + archive + ', dest_dir=' + dest_dir + ')') - url = urljoin(emsdk_packages_url, zipfile) - download_target = get_download_target(url, zips_subdir, filename_prefix) + url = urljoin(emsdk_packages_url, archive) + download_target = get_download_target(url, download_dir, filename_prefix) - received_download_target = download_file(url, zips_subdir, not KEEP_DOWNLOADS, filename_prefix) + received_download_target = download_file(url, download_dir, not KEEP_DOWNLOADS, filename_prefix) if not received_download_target: return False assert received_download_target == download_target @@ -1423,7 +1423,7 @@ def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True): # could remain. if clobber: remove_tree(dest_dir) - if zipfile.endswith('.zip'): + if archive.endswith('.zip'): return unzip(download_target, dest_dir) else: return untargz(download_target, dest_dir) @@ -1880,7 +1880,8 @@ def install_tool(self): elif hasattr(self, 'git_branch'): success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch) elif url.endswith(ARCHIVE_SUFFIXES): - success = download_and_unzip(url, self.installation_path(), filename_prefix=getattr(self, 'zipfile_prefix', '')) + success = download_and_extract(url, self.installation_path(), + filename_prefix=getattr(self, 'download_prefix', '')) else: assert False, 'unhandled url type: ' + url @@ -1930,8 +1931,8 @@ def cleanup_temp_install_files(self): return url = self.download_url() if url.endswith(ARCHIVE_SUFFIXES): - download_target = get_download_target(url, zips_subdir, getattr(self, 'zipfile_prefix', '')) - debug_print("Deleting temporary zip file " + download_target) + download_target = get_download_target(url, download_dir, getattr(self, 'download_prefix', '')) + debug_print("Deleting temporary download: " + download_target) rmfile(download_target) def uninstall(self): @@ -2116,7 +2117,7 @@ def update_emsdk(): if is_emsdk_sourced_from_github(): errlog('You seem to have bootstrapped Emscripten SDK by cloning from GitHub. In this case, use "git pull" instead of "emsdk update" to update emsdk. (Not doing that automatically in case you have local changes)') sys.exit(1) - if not download_and_unzip(emsdk_zip_download_url, EMSDK_PATH, clobber=False): + if not download_and_extract(emsdk_zip_download_url, EMSDK_PATH, clobber=False): sys.exit(1) diff --git a/emsdk_manifest.json b/emsdk_manifest.json index f7f3a2b4d8..1fb2ca26a8 100644 --- a/emsdk_manifest.json +++ b/emsdk_manifest.json @@ -37,7 +37,7 @@ "linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2", "macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2", "windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/win/%releases-tag%/wasm-binaries.zip", - "zipfile_prefix": "%releases-tag%-", + "download_prefix": "%releases-tag%-", "install_path": "upstream", "activated_path": "%installation_dir%/emscripten", "activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'", @@ -50,7 +50,7 @@ "arch": "arm64", "macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries-arm64.tbz2", "linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries-arm64.tbz2", - "zipfile_prefix": "%releases-tag%-", + "download_prefix": "%releases-tag%-", "install_path": "upstream", "activated_path": "%installation_dir%/emscripten", "activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'", @@ -478,7 +478,7 @@ "append_bitness": false, "windows_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.zip", "unix_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.tar.gz", - "zipfile_prefix": "emscripten-e", + "download_prefix": "emscripten-e", "activated_cfg": "EMSCRIPTEN_ROOT='%installation_dir%';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%%generator_prefix%_32bit_optimizer/%cmake_build_type_on_win%optimizer%.exe%'", "activated_path": "%installation_dir%", "activated_env": "EMSCRIPTEN=%installation_dir%;EMSCRIPTEN_NATIVE_OPTIMIZER=%installation_dir%%generator_prefix%_32bit_optimizer/%cmake_build_type_on_win%optimizer%.exe%", @@ -518,7 +518,7 @@ "append_bitness": false, "windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip", "unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz", - "zipfile_prefix": "binaryen-e", + "download_prefix": "binaryen-e", "activated_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'", "activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin", "activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen", @@ -534,7 +534,7 @@ "append_bitness": false, "windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip", "unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz", - "zipfile_prefix": "binaryen-e", + "download_prefix": "binaryen-e", "activated_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'", "activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin", "activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen", diff --git a/test/test.py b/test/test.py index 32cbad25ec..1b1233c613 100755 --- a/test/test.py +++ b/test/test.py @@ -269,7 +269,7 @@ def test_keep_downloads(self): # With EMSDK_KEEP_DOWNLOADS the downloading should happen on the first # install of 2.0.28, and again when we install 2.0.29, but not on the # second install of 2.0.28 because the zip should already be local. - shutil.rmtree('zips') + shutil.rmtree('downloads') checked_call_with_output(emsdk + ' install 2.0.28', expected='Downloading:', env=env) checked_call_with_output(emsdk + ' install 2.0.29', expected='Downloading:', env=env) checked_call_with_output(emsdk + ' install 2.0.28', expected='already downloaded, skipping', unexpected='Downloading:', env=env)