Rename zipfile to archive or download as appropriate. NFC (#1257)
This commit is contained in:
2
.flake8
2
.flake8
@@ -19,5 +19,5 @@ exclude =
|
|||||||
./node
|
./node
|
||||||
./python
|
./python
|
||||||
./temp
|
./temp
|
||||||
./zips
|
./downloads
|
||||||
./crunch
|
./crunch
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -27,7 +27,7 @@ __pycache__
|
|||||||
/node
|
/node
|
||||||
/python
|
/python
|
||||||
/temp
|
/temp
|
||||||
/zips
|
/downloads
|
||||||
/crunch
|
/crunch
|
||||||
/java
|
/java
|
||||||
/mingw
|
/mingw
|
||||||
|
|||||||
23
emsdk.py
23
emsdk.py
@@ -49,7 +49,7 @@ emscripten_releases_download_url_template = "https://storage.googleapis.com/weba
|
|||||||
# `main.zip` perhaps.
|
# `main.zip` perhaps.
|
||||||
emsdk_zip_download_url = 'https://github.com/emscripten-core/emsdk/archive/HEAD.zip'
|
emsdk_zip_download_url = 'https://github.com/emscripten-core/emsdk/archive/HEAD.zip'
|
||||||
|
|
||||||
zips_subdir = 'zips/'
|
download_dir = 'downloads/'
|
||||||
|
|
||||||
extra_release_tag = None
|
extra_release_tag = None
|
||||||
|
|
||||||
@@ -1403,13 +1403,13 @@ def build_binaryen_tool(tool):
|
|||||||
return success
|
return success
|
||||||
|
|
||||||
|
|
||||||
def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
|
def download_and_extract(archive, dest_dir, filename_prefix='', clobber=True):
|
||||||
debug_print('download_and_unzip(zipfile=' + zipfile + ', dest_dir=' + dest_dir + ')')
|
debug_print('download_and_extract(archive=' + archive + ', dest_dir=' + dest_dir + ')')
|
||||||
|
|
||||||
url = urljoin(emsdk_packages_url, zipfile)
|
url = urljoin(emsdk_packages_url, archive)
|
||||||
download_target = get_download_target(url, zips_subdir, filename_prefix)
|
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:
|
if not received_download_target:
|
||||||
return False
|
return False
|
||||||
assert received_download_target == download_target
|
assert received_download_target == download_target
|
||||||
@@ -1419,7 +1419,7 @@ def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
|
|||||||
# could remain.
|
# could remain.
|
||||||
if clobber:
|
if clobber:
|
||||||
remove_tree(dest_dir)
|
remove_tree(dest_dir)
|
||||||
if zipfile.endswith('.zip'):
|
if archive.endswith('.zip'):
|
||||||
return unzip(download_target, dest_dir)
|
return unzip(download_target, dest_dir)
|
||||||
else:
|
else:
|
||||||
return untargz(download_target, dest_dir)
|
return untargz(download_target, dest_dir)
|
||||||
@@ -1874,7 +1874,8 @@ class Tool(object):
|
|||||||
elif hasattr(self, 'git_branch'):
|
elif hasattr(self, 'git_branch'):
|
||||||
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
|
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
|
||||||
elif url.endswith(ARCHIVE_SUFFIXES):
|
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:
|
else:
|
||||||
assert False, 'unhandled url type: ' + url
|
assert False, 'unhandled url type: ' + url
|
||||||
|
|
||||||
@@ -1924,8 +1925,8 @@ class Tool(object):
|
|||||||
return
|
return
|
||||||
url = self.download_url()
|
url = self.download_url()
|
||||||
if url.endswith(ARCHIVE_SUFFIXES):
|
if url.endswith(ARCHIVE_SUFFIXES):
|
||||||
download_target = get_download_target(url, zips_subdir, getattr(self, 'zipfile_prefix', ''))
|
download_target = get_download_target(url, download_dir, getattr(self, 'download_prefix', ''))
|
||||||
debug_print("Deleting temporary zip file " + download_target)
|
debug_print("Deleting temporary download: " + download_target)
|
||||||
rmfile(download_target)
|
rmfile(download_target)
|
||||||
|
|
||||||
def uninstall(self):
|
def uninstall(self):
|
||||||
@@ -2110,7 +2111,7 @@ def update_emsdk():
|
|||||||
if is_emsdk_sourced_from_github():
|
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)')
|
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)
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2",
|
"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",
|
"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",
|
"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",
|
"install_path": "upstream",
|
||||||
"activated_path": "%installation_dir%/emscripten",
|
"activated_path": "%installation_dir%/emscripten",
|
||||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%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",
|
"arch": "arm64",
|
||||||
"macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries-arm64.tbz2",
|
"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",
|
"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",
|
"install_path": "upstream",
|
||||||
"activated_path": "%installation_dir%/emscripten",
|
"activated_path": "%installation_dir%/emscripten",
|
||||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%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,
|
"append_bitness": false,
|
||||||
"windows_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.zip",
|
"windows_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.zip",
|
||||||
"unix_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.tar.gz",
|
"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_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_path": "%installation_dir%",
|
||||||
"activated_env": "EMSCRIPTEN=%installation_dir%;EMSCRIPTEN_NATIVE_OPTIMIZER=%installation_dir%%generator_prefix%_32bit_optimizer/%cmake_build_type_on_win%optimizer%.exe%",
|
"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,
|
"append_bitness": false,
|
||||||
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
|
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
|
||||||
"unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz",
|
"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_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'",
|
||||||
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
|
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
|
||||||
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",
|
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",
|
||||||
@@ -534,7 +534,7 @@
|
|||||||
"append_bitness": false,
|
"append_bitness": false,
|
||||||
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
|
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
|
||||||
"unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz",
|
"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_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'",
|
||||||
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
|
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
|
||||||
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",
|
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ int main() {
|
|||||||
# With EMSDK_KEEP_DOWNLOADS the downloading should happen on the first
|
# 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
|
# 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.
|
# 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.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.29', expected='Downloading:', env=env)
|
||||||
checked_call_with_output(emsdk + ' install 2.0.28', expected='already downloaded, skipping', unexpected='Downloading:', env=env)
|
checked_call_with_output(emsdk + ' install 2.0.28', expected='already downloaded, skipping', unexpected='Downloading:', env=env)
|
||||||
|
|||||||
Reference in New Issue
Block a user