Skip to content

Commit dc6e0d4

Browse files
authored
Remove temp zip after uncompressing in update_python.py (#1470)
Remove temp zip after uncompressing in update_python.py to avoid confusing it with the output artifact zip. Adjust comments.
1 parent 2ba3fca commit dc6e0d4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

emsdk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ def main(args):
27142714
errlog("Missing command; Type 'emsdk help' to get a list of commands.")
27152715
return 1
27162716

2717-
debug_print('esmdk.py running under `%s`' % sys.executable)
2717+
debug_print('emsdk.py running under `%s`' % sys.executable)
27182718
cmd = args.pop(0)
27192719

27202720
if cmd in ('help', '--help', '-h'):

scripts/update_python.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
version = '3.9.2'
3535
major_minor_version = '.'.join(version.split('.')[:2]) # e.g. '3.9.2' -> '3.9'
3636
download_url = 'https://www.nuget.org/api/v2/package/python/%s' % version
37+
# This is not part of official Python version, but a repackaging number appended by emsdk
38+
# when a version of Python needs to be redownloaded.
3739
revision = '4'
3840

3941
pywin32_version = '227'
@@ -70,11 +72,12 @@ def make_python_patch():
7072
urllib.request.urlretrieve(url, pywin32_filename)
7173

7274
if not os.path.exists(filename):
73-
print('Downloading python: ' + download_url)
75+
print(f'Downloading python: {download_url} to {filename}')
7476
urllib.request.urlretrieve(download_url, filename)
7577

7678
os.mkdir('python-nuget')
7779
check_call(unzip_cmd() + [os.path.abspath(filename)], cwd='python-nuget')
80+
os.remove(filename)
7881

7982
os.mkdir('pywin32')
8083
rtn = subprocess.call(unzip_cmd() + [os.path.abspath(pywin32_filename)], cwd='pywin32')
@@ -84,12 +87,12 @@ def make_python_patch():
8487
shutil.move(os.path.join('pywin32', 'PLATLIB'), os.path.join('python-nuget', 'toolss', 'Lib', 'site-packages'))
8588

8689
check_call(zip_cmd() + [os.path.join('..', '..', out_filename), '.'], cwd='python-nuget/tools')
90+
print('Created: %s' % out_filename)
8791

8892
# cleanup if everything went fine
8993
shutil.rmtree('python-nuget')
9094
shutil.rmtree('pywin32')
9195

92-
print('Created: %s' % out_filename)
9396
if '--upload' in sys.argv:
9497
upload_url = upload_base + out_filename
9598
print('Uploading: ' + upload_url)
@@ -153,6 +156,10 @@ def build_python():
153156
pybin = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'python3')
154157
pip = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'pip3')
155158
check_call([pybin, '-m', 'ensurepip', '--upgrade'])
159+
# TODO: Potential bug: the following cmdline does not pin down a version
160+
# of requests module, resulting in possibly different version of the module
161+
# being installed on future runs. Switch to pip install requests==<version> to
162+
# to download a pinned version.
156163
check_call([pybin, pip, 'install', 'requests'])
157164

158165
# Install psutil module. This is needed by emrun to track when browser

0 commit comments

Comments
 (0)