2020-05-04 18:08:43 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
# Copyright 2020 The Emscripten Authors. All rights reserved.
|
|
|
|
|
# Emscripten is available under two separate licenses, the MIT license and the
|
|
|
|
|
# University of Illinois/NCSA Open Source License. Both these licenses can be
|
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
"""Updates the node binaries that we cache store at
|
|
|
|
|
http://storage.google.com/webassembly.
|
|
|
|
|
|
|
|
|
|
For the windows version we also alter the directory layout to add the 'bin'
|
|
|
|
|
direcotry.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import urllib.request
|
|
|
|
|
import subprocess
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
|
2023-06-20 11:57:05 -07:00
|
|
|
version = '16.20.0'
|
|
|
|
|
base = 'https://nodejs.org/dist/latest-v16.x/'
|
2020-05-04 18:08:43 -04:00
|
|
|
upload_base = 'gs://webassembly/emscripten-releases-builds/deps/'
|
|
|
|
|
|
|
|
|
|
suffixes = [
|
2023-04-11 11:17:46 -07:00
|
|
|
'-win-x86.zip',
|
2020-05-04 18:08:43 -04:00
|
|
|
'-win-x64.zip',
|
|
|
|
|
'-darwin-x64.tar.gz',
|
2023-06-20 11:57:05 -07:00
|
|
|
'-darwin-arm64.tar.gz',
|
2020-05-04 18:08:43 -04:00
|
|
|
'-linux-x64.tar.xz',
|
|
|
|
|
'-linux-arm64.tar.xz',
|
|
|
|
|
'-linux-armv7l.tar.xz',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for suffix in suffixes:
|
|
|
|
|
filename = 'node-v%s%s' % (version, suffix)
|
|
|
|
|
download_url = base + filename
|
|
|
|
|
print('Downloading: ' + download_url)
|
|
|
|
|
urllib.request.urlretrieve(download_url, filename)
|
|
|
|
|
|
|
|
|
|
if '-win-' in suffix:
|
|
|
|
|
subprocess.check_call(['unzip', '-q', filename])
|
|
|
|
|
dirname = os.path.splitext(os.path.basename(filename))[0]
|
|
|
|
|
shutil.move(dirname, 'bin')
|
|
|
|
|
os.mkdir(dirname)
|
|
|
|
|
shutil.move('bin', dirname)
|
2021-02-12 16:47:20 -08:00
|
|
|
os.remove(filename)
|
2020-05-04 18:08:43 -04:00
|
|
|
subprocess.check_call(['zip', '-rq', filename, dirname])
|
|
|
|
|
shutil.rmtree(dirname)
|
|
|
|
|
|
|
|
|
|
upload_url = upload_base + filename
|
|
|
|
|
print('Uploading: ' + upload_url)
|
|
|
|
|
cmd = ['gsutil', 'cp', '-n', filename, upload_url]
|
|
|
|
|
print(' '.join(cmd))
|
|
|
|
|
subprocess.check_call(cmd)
|
|
|
|
|
os.remove(filename)
|