Skip to content

Commit 8c1d600

Browse files
sbc100shlomif
authored andcommitted
Rename zipfile to archive or download as appropriate. NFC (emscripten-core#1257)
1 parent c3870d4 commit 8c1d600

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ exclude =
1919
./node
2020
./python
2121
./temp
22-
./zips
22+
./downloads
2323
./crunch

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ __pycache__
2727
/node
2828
/python
2929
/temp
30-
/zips
30+
/downloads
3131
/crunch
3232
/java
3333
/mingw

emsdk.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# `main.zip` perhaps.
5252
emsdk_zip_download_url = 'https://github.com/emscripten-core/emsdk/archive/HEAD.zip'
5353

54-
zips_subdir = 'zips/'
54+
download_dir = 'downloads/'
5555

5656
extra_release_tag = None
5757

@@ -1407,13 +1407,13 @@ def build_binaryen_tool(tool):
14071407
return success
14081408

14091409

1410-
def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
1411-
debug_print('download_and_unzip(zipfile=' + zipfile + ', dest_dir=' + dest_dir + ')')
1410+
def download_and_extract(archive, dest_dir, filename_prefix='', clobber=True):
1411+
debug_print('download_and_extract(archive=' + archive + ', dest_dir=' + dest_dir + ')')
14121412

1413-
url = urljoin(emsdk_packages_url, zipfile)
1414-
download_target = get_download_target(url, zips_subdir, filename_prefix)
1413+
url = urljoin(emsdk_packages_url, archive)
1414+
download_target = get_download_target(url, download_dir, filename_prefix)
14151415

1416-
received_download_target = download_file(url, zips_subdir, not KEEP_DOWNLOADS, filename_prefix)
1416+
received_download_target = download_file(url, download_dir, not KEEP_DOWNLOADS, filename_prefix)
14171417
if not received_download_target:
14181418
return False
14191419
assert received_download_target == download_target
@@ -1423,7 +1423,7 @@ def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
14231423
# could remain.
14241424
if clobber:
14251425
remove_tree(dest_dir)
1426-
if zipfile.endswith('.zip'):
1426+
if archive.endswith('.zip'):
14271427
return unzip(download_target, dest_dir)
14281428
else:
14291429
return untargz(download_target, dest_dir)
@@ -1880,7 +1880,8 @@ def install_tool(self):
18801880
elif hasattr(self, 'git_branch'):
18811881
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
18821882
elif url.endswith(ARCHIVE_SUFFIXES):
1883-
success = download_and_unzip(url, self.installation_path(), filename_prefix=getattr(self, 'zipfile_prefix', ''))
1883+
success = download_and_extract(url, self.installation_path(),
1884+
filename_prefix=getattr(self, 'download_prefix', ''))
18841885
else:
18851886
assert False, 'unhandled url type: ' + url
18861887

@@ -1930,8 +1931,8 @@ def cleanup_temp_install_files(self):
19301931
return
19311932
url = self.download_url()
19321933
if url.endswith(ARCHIVE_SUFFIXES):
1933-
download_target = get_download_target(url, zips_subdir, getattr(self, 'zipfile_prefix', ''))
1934-
debug_print("Deleting temporary zip file " + download_target)
1934+
download_target = get_download_target(url, download_dir, getattr(self, 'download_prefix', ''))
1935+
debug_print("Deleting temporary download: " + download_target)
19351936
rmfile(download_target)
19361937

19371938
def uninstall(self):
@@ -2116,7 +2117,7 @@ def update_emsdk():
21162117
if is_emsdk_sourced_from_github():
21172118
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)')
21182119
sys.exit(1)
2119-
if not download_and_unzip(emsdk_zip_download_url, EMSDK_PATH, clobber=False):
2120+
if not download_and_extract(emsdk_zip_download_url, EMSDK_PATH, clobber=False):
21202121
sys.exit(1)
21212122

21222123

emsdk_manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2",
3838
"macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2",
3939
"windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/win/%releases-tag%/wasm-binaries.zip",
40-
"zipfile_prefix": "%releases-tag%-",
40+
"download_prefix": "%releases-tag%-",
4141
"install_path": "upstream",
4242
"activated_path": "%installation_dir%/emscripten",
4343
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
@@ -50,7 +50,7 @@
5050
"arch": "arm64",
5151
"macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries-arm64.tbz2",
5252
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries-arm64.tbz2",
53-
"zipfile_prefix": "%releases-tag%-",
53+
"download_prefix": "%releases-tag%-",
5454
"install_path": "upstream",
5555
"activated_path": "%installation_dir%/emscripten",
5656
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
@@ -478,7 +478,7 @@
478478
"append_bitness": false,
479479
"windows_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.zip",
480480
"unix_url": "https://github.com/emscripten-core/emscripten/archive/%tag%.tar.gz",
481-
"zipfile_prefix": "emscripten-e",
481+
"download_prefix": "emscripten-e",
482482
"activated_cfg": "EMSCRIPTEN_ROOT='%installation_dir%';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%%generator_prefix%_32bit_optimizer/%cmake_build_type_on_win%optimizer%.exe%'",
483483
"activated_path": "%installation_dir%",
484484
"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 @@
518518
"append_bitness": false,
519519
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
520520
"unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz",
521-
"zipfile_prefix": "binaryen-e",
521+
"download_prefix": "binaryen-e",
522522
"activated_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'",
523523
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
524524
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",
@@ -534,7 +534,7 @@
534534
"append_bitness": false,
535535
"windows_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.zip",
536536
"unix_url": "https://github.com/WebAssembly/binaryen/archive/%binaryen_tag%.tar.gz",
537-
"zipfile_prefix": "binaryen-e",
537+
"download_prefix": "binaryen-e",
538538
"activated_cfg": "BINARYEN_ROOT='%installation_dir%%generator_prefix%_64bit_binaryen'",
539539
"activated_path": "%installation_dir%%generator_prefix%_64bit_binaryen/bin",
540540
"activated_env": "BINARYEN_ROOT=%installation_dir%%generator_prefix%_64bit_binaryen",

test/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_keep_downloads(self):
269269
# With EMSDK_KEEP_DOWNLOADS the downloading should happen on the first
270270
# install of 2.0.28, and again when we install 2.0.29, but not on the
271271
# second install of 2.0.28 because the zip should already be local.
272-
shutil.rmtree('zips')
272+
shutil.rmtree('downloads')
273273
checked_call_with_output(emsdk + ' install 2.0.28', expected='Downloading:', env=env)
274274
checked_call_with_output(emsdk + ' install 2.0.29', expected='Downloading:', env=env)
275275
checked_call_with_output(emsdk + ' install 2.0.28', expected='already downloaded, skipping', unexpected='Downloading:', env=env)

0 commit comments

Comments
 (0)