Skip to content

Commit 0fe3d48

Browse files
authored
Update to python 3.9.2 on Windows as well. Mark old Python and Node packages. (#758)
1 parent 9c65611 commit 0fe3d48

File tree

5 files changed

+71
-24
lines changed

5 files changed

+71
-24
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ https://emscripten.org/docs/building_from_source/toolchain_what_is_needed.html.
5656

5757
### Mac OS X
5858

59-
- `python`: Version 2.7.0 or above.
59+
- For Intel-based Macs, macOS 10.13 or newer. For ARM64 M1 based Macs, macOS
60+
11.0 or newer.
6061
- `java`: For running closure compiler (optional). After installing emscripten
6162
via emsdk, typing 'emcc --help' should pop up a OS X dialog "Java is not
6263
installed. To open java, you need a Java SE 6 runtime. Would you like to

emsdk.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ setlocal
77
:: When using our bundled python we never want the users
88
:: PYTHONHOME or PYTHONPATH
99
:: https://github.com/emscripten-core/emsdk/issues/598
10+
if exist "%~dp0python\3.9.2-1_64bit\python.exe" (
11+
set EMSDK_PY="%~dp0python\3.9.2-1_64bit\python.exe"
12+
set PYTHONHOME=
13+
set PYTHONPATH=
14+
goto end
15+
)
16+
1017
if exist "%~dp0python\3.7.4-pywin32_64bit\python.exe" (
1118
set EMSDK_PY="%~dp0python\3.7.4-pywin32_64bit\python.exe"
1219
set PYTHONHOME=

emsdk.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$ScriptDirectory = Split-Path -parent $PSCommandPath
22

33
$PythonLocations = $(
4+
"python\3.9.2-1_64bit\python.exe",
45
"python\3.7.4-pywin32_64bit\python.exe",
56
"python\3.7.4_64bit\python.exe",
67
"python\2.7.13.1_64bit\python-2.7.13.amd64\python.exe",

emsdk_manifest.json

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@
150150
"linux_url": "node-v8.9.1-linux-x86.tar.xz",
151151
"activated_path": "%installation_dir%/bin",
152152
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
153-
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
153+
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%",
154+
"is_old": true
154155
},
155156
{
156157
"id": "node",
@@ -160,7 +161,8 @@
160161
"linux_url": "https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-armv7l.tar.xz",
161162
"activated_path": "%installation_dir%/bin",
162163
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
163-
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
164+
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%",
165+
"is_old": true
164166
},
165167
{
166168
"id": "node",
@@ -172,7 +174,8 @@
172174
"linux_url": "node-v8.9.1-linux-x64.tar.xz",
173175
"activated_path": "%installation_dir%/bin",
174176
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
175-
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
177+
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%",
178+
"is_old": true
176179
},
177180
{
178181
"id": "node",
@@ -182,7 +185,8 @@
182185
"linux_url": "node-v8.9.1-linux-arm64.tar.xz",
183186
"activated_path": "%installation_dir%/bin",
184187
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
185-
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
188+
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%",
189+
"is_old": true
186190
},
187191
{
188192
"id": "node",
@@ -234,7 +238,8 @@
234238
"arch": "x86",
235239
"windows_url": "WinPython-32bit-2.7.13.1Zero.zip",
236240
"activated_cfg": "PYTHON='%installation_dir%/python-2.7.13/python%.exe%'",
237-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python-2.7.13/python%.exe%"
241+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python-2.7.13/python%.exe%",
242+
"is_old": true
238243
},
239244
{
240245
"id": "python",
@@ -243,7 +248,8 @@
243248
"arch": "x86_64",
244249
"windows_url": "WinPython-64bit-2.7.13.1Zero.zip",
245250
"activated_cfg": "PYTHON='%installation_dir%/python-2.7.13.amd64/python%.exe%'",
246-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python-2.7.13.amd64/python%.exe%"
251+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python-2.7.13.amd64/python%.exe%",
252+
"is_old": true
247253
},
248254
{
249255
"id": "python",
@@ -252,7 +258,8 @@
252258
"arch": "x86",
253259
"windows_url": "python-3.7.4-embed-win32-patched.zip",
254260
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
255-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
261+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe",
262+
"is_old": true
256263
},
257264
{
258265
"id": "python",
@@ -261,7 +268,8 @@
261268
"arch": "x86_64",
262269
"windows_url": "python-3.7.4-embed-amd64-patched.zip",
263270
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
264-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
271+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe",
272+
"is_old": true
265273
},
266274
{
267275
"id": "python",
@@ -270,7 +278,8 @@
270278
"arch": "x86",
271279
"windows_url": "python-3.7.4-embed-win32+pywin32.zip",
272280
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
273-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
281+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe",
282+
"is_old": true
274283
},
275284
{
276285
"id": "python",
@@ -279,7 +288,8 @@
279288
"arch": "x86_64",
280289
"windows_url": "python-3.7.4-embed-amd64+pywin32.zip",
281290
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
282-
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
291+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe",
292+
"is_old": true
283293
},
284294
{
285295
"id": "python",
@@ -288,7 +298,17 @@
288298
"arch": "x86_64",
289299
"macos_url": "python-3.7.4-2-macos.tar.gz",
290300
"activated_cfg": "PYTHON='%installation_dir%/bin/python3'",
291-
"activated_env": "EMSDK_PYTHON=%installation_dir%/bin/python3;SSL_CERT_FILE=%installation_dir%/lib/python3.7/site-packages/certifi/cacert.pem"
301+
"activated_env": "EMSDK_PYTHON=%installation_dir%/bin/python3;SSL_CERT_FILE=%installation_dir%/lib/python3.7/site-packages/certifi/cacert.pem",
302+
"is_old": true
303+
},
304+
{
305+
"id": "python",
306+
"version": "3.9.2-1",
307+
"bitness": 64,
308+
"arch": "x86_64",
309+
"windows_url": "python-3.9.2-1-embed-amd64+pywin32.zip",
310+
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
311+
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
292312
},
293313
{
294314
"id": "python",
@@ -506,7 +526,7 @@
506526
{
507527
"version": "upstream-main",
508528
"bitness": 64,
509-
"uses": ["python-3.7.4-pywin32-64bit", "llvm-git-main-64bit", "node-14.15.5-64bit", "emscripten-main-64bit", "binaryen-main-64bit"],
529+
"uses": ["python-3.9.2-1-64bit", "llvm-git-main-64bit", "node-14.15.5-64bit", "emscripten-main-64bit", "binaryen-main-64bit"],
510530
"os": "win"
511531
},
512532
{
@@ -573,15 +593,15 @@
573593
{
574594
"version": "releases-upstream-%releases-tag%",
575595
"bitness": 64,
576-
"uses": ["node-14.15.5-64bit", "python-3.7.4-2-64bit", "releases-upstream-%releases-tag%-64bit"],
596+
"uses": ["node-14.15.5-64bit", "python-3.9.2-1-64bit", "releases-upstream-%releases-tag%-64bit"],
577597
"os": "macos",
578598
"arch": "x86_64",
579599
"custom_install_script": "emscripten_npm_install"
580600
},
581601
{
582602
"version": "releases-upstream-%releases-tag%",
583603
"bitness": 64,
584-
"uses": ["node-14.15.5-64bit", "python-3.7.4-pywin32-64bit", "java-8.152-64bit", "releases-upstream-%releases-tag%-64bit"],
604+
"uses": ["node-14.15.5-64bit", "python-3.9.2-1-64bit", "java-8.152-64bit", "releases-upstream-%releases-tag%-64bit"],
585605
"os": "win",
586606
"custom_install_script": "emscripten_npm_install"
587607
},

scripts/update_python.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,31 @@
4242
upload_base = 'gs://webassembly/emscripten-releases-builds/deps/'
4343

4444

45+
def unzip_cmd():
46+
# Use 7-Zip if available (https://www.7-zip.org/)
47+
sevenzip = os.path.join(os.getenv('ProgramFiles'), '7-Zip', '7z.exe')
48+
if os.path.isfile(sevenzip):
49+
return [sevenzip, 'x']
50+
# Fall back to 'unzip' tool
51+
return ['unzip', '-q']
52+
53+
54+
def zip_cmd():
55+
# Use 7-Zip if available (https://www.7-zip.org/)
56+
sevenzip = os.path.join(os.getenv('ProgramFiles'), '7-Zip', '7z.exe')
57+
if os.path.isfile(sevenzip):
58+
return [sevenzip, 'a', '-mx9']
59+
# Fall back to 'zip' tool
60+
return ['zip', '-rq']
61+
62+
4563
def make_python_patch(arch):
4664
if arch == 'amd64':
4765
pywin32_filename = 'pywin32-%s.win-%s-py%s.exe' % (pywin32_version, arch, major_minor_version)
4866
else:
4967
pywin32_filename = 'pywin32-%s.%s-py%s.exe' % (pywin32_version, arch, major_minor_version)
5068
filename = 'python-%s-embed-%s.zip' % (version, arch)
51-
out_filename = 'python-%s-embed-%s+pywin32.zip' % (version, arch)
69+
out_filename = 'python-%s-%s-embed-%s+pywin32.zip' % (version, revision, arch)
5270
if not os.path.exists(pywin32_filename):
5371
download_url = pywin32_base + pywin32_filename
5472
print('Downloading pywin32: ' + download_url)
@@ -60,28 +78,28 @@ def make_python_patch(arch):
6078
urllib.request.urlretrieve(download_url, filename)
6179

6280
os.mkdir('python-embed')
63-
check_call(['unzip', '-q', os.path.abspath(filename)], cwd='python-embed')
64-
os.remove(os.path.join('python-embed', 'python37._pth'))
81+
check_call(unzip_cmd() + [os.path.abspath(filename)], cwd='python-embed')
82+
os.remove(os.path.join('python-embed', 'python%s._pth' % major_minor_version.replace('.', '')))
6583

6684
os.mkdir('pywin32')
67-
rtn = subprocess.call(['unzip', '-q', os.path.abspath(pywin32_filename)], cwd='pywin32')
85+
rtn = subprocess.call(unzip_cmd() + [os.path.abspath(pywin32_filename)], cwd='pywin32')
6886
assert rtn in [0, 1]
6987

7088
os.mkdir(os.path.join('python-embed', 'lib'))
7189
shutil.move(os.path.join('pywin32', 'PLATLIB'), os.path.join('python-embed', 'lib', 'site-packages'))
7290

73-
check_call(['zip', '-rq', os.path.join('..', out_filename), '.'], cwd='python-embed')
91+
check_call(zip_cmd() + [os.path.join('..', out_filename), '.'], cwd='python-embed')
92+
93+
# cleanup if everything went fine
94+
shutil.rmtree('python-embed')
95+
shutil.rmtree('pywin32')
7496

7597
upload_url = upload_base + out_filename
7698
print('Uploading: ' + upload_url)
7799
cmd = ['gsutil', 'cp', '-n', out_filename, upload_url]
78100
print(' '.join(cmd))
79101
check_call(cmd)
80102

81-
# cleanup if everything went fine
82-
shutil.rmtree('python-embed')
83-
shutil.rmtree('pywin32')
84-
85103

86104
def build_python():
87105
if sys.platform.startswith('darwin'):

0 commit comments

Comments
 (0)