Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename zipfile to archive or download as appropriate. NFC
Browse files Browse the repository at this point in the history
sbc100 committed Jul 10, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e28e476 commit cbdd0cc
Showing 2 changed files with 17 additions and 16 deletions.
23 changes: 12 additions & 11 deletions emsdk.py
Original file line number Diff line number Diff line change
@@ -49,7 +49,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

@@ -1403,13 +1403,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
@@ -1419,7 +1419,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)
@@ -1874,7 +1874,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

@@ -1924,8 +1925,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):
@@ -2110,7 +2111,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)


10 changes: 5 additions & 5 deletions emsdk_manifest.json
Original file line number Diff line number Diff line change
@@ -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",

0 comments on commit cbdd0cc

Please sign in to comment.