Skip to content

Commit 4f2db96

Browse files
authored
Rename zipfile to archive or download as appropriate. NFC (#1257)
1 parent 11fa694 commit 4f2db96

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
@@ -49,7 +49,7 @@
4949
# `main.zip` perhaps.
5050
emsdk_zip_download_url = 'https://github.com/emscripten-core/emsdk/archive/HEAD.zip'
5151

52-
zips_subdir = 'zips/'
52+
download_dir = 'downloads/'
5353

5454
extra_release_tag = None
5555

@@ -1403,13 +1403,13 @@ def build_binaryen_tool(tool):
14031403
return success
14041404

14051405

1406-
def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
1407-
debug_print('download_and_unzip(zipfile=' + zipfile + ', dest_dir=' + dest_dir + ')')
1406+
def download_and_extract(archive, dest_dir, filename_prefix='', clobber=True):
1407+
debug_print('download_and_extract(archive=' + archive + ', dest_dir=' + dest_dir + ')')
14081408

1409-
url = urljoin(emsdk_packages_url, zipfile)
1410-
download_target = get_download_target(url, zips_subdir, filename_prefix)
1409+
url = urljoin(emsdk_packages_url, archive)
1410+
download_target = get_download_target(url, download_dir, filename_prefix)
14111411

1412-
received_download_target = download_file(url, zips_subdir, not KEEP_DOWNLOADS, filename_prefix)
1412+
received_download_target = download_file(url, download_dir, not KEEP_DOWNLOADS, filename_prefix)
14131413
if not received_download_target:
14141414
return False
14151415
assert received_download_target == download_target
@@ -1419,7 +1419,7 @@ def download_and_unzip(zipfile, dest_dir, filename_prefix='', clobber=True):
14191419
# could remain.
14201420
if clobber:
14211421
remove_tree(dest_dir)
1422-
if zipfile.endswith('.zip'):
1422+
if archive.endswith('.zip'):
14231423
return unzip(download_target, dest_dir)
14241424
else:
14251425
return untargz(download_target, dest_dir)
@@ -1874,7 +1874,8 @@ def install_tool(self):
18741874
elif hasattr(self, 'git_branch'):
18751875
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
18761876
elif url.endswith(ARCHIVE_SUFFIXES):
1877-
success = download_and_unzip(url, self.installation_path(), filename_prefix=getattr(self, 'zipfile_prefix', ''))
1877+
success = download_and_extract(url, self.installation_path(),
1878+
filename_prefix=getattr(self, 'download_prefix', ''))
18781879
else:
18791880
assert False, 'unhandled url type: ' + url
18801881

@@ -1924,8 +1925,8 @@ def cleanup_temp_install_files(self):
19241925
return
19251926
url = self.download_url()
19261927
if url.endswith(ARCHIVE_SUFFIXES):
1927-
download_target = get_download_target(url, zips_subdir, getattr(self, 'zipfile_prefix', ''))
1928-
debug_print("Deleting temporary zip file " + download_target)
1928+
download_target = get_download_target(url, download_dir, getattr(self, 'download_prefix', ''))
1929+
debug_print("Deleting temporary download: " + download_target)
19291930
rmfile(download_target)
19301931

19311932
def uninstall(self):
@@ -2110,7 +2111,7 @@ def update_emsdk():
21102111
if is_emsdk_sourced_from_github():
21112112
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)')
21122113
sys.exit(1)
2113-
if not download_and_unzip(emsdk_zip_download_url, EMSDK_PATH, clobber=False):
2114+
if not download_and_extract(emsdk_zip_download_url, EMSDK_PATH, clobber=False):
21142115
sys.exit(1)
21152116

21162117

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)