When `emsdk install foo` would fail on Windows, the return code would
get ignored since there were later commands in the script file.
To fix that, capture the error code from the emsdk call, and output that
as the final return code.
Also a drive-by Python path fix, which seemed to be out of date in the
.ps1 file.
The `-0` and `-1` suffixes here are not part of the install path which
only based on the `id` and `version` of the tool. e.g:
```
{
"id": "python",
"version": "3.9.2",
"bitness": 64,
"arch": "x86_64",
"windows_url": "python-3.9.2-1-embed-amd64+pywin32.zip",
"activated_cfg": "PYTHON='%installation_dir%/python.exe'",
"activated_env": "EMSDK_PYTHON=%installation_dir%/python.exe"
},
```
Here we have a `-1` in the archive name, but that is not included in the
version which is used to construct the install path.
Fixes: #1570
Update Python to 3.13.0 and add support to Windows on AMD64. Rewrite
packaging of pywin32 because it is no longer shipped via separate binary
installers, but has migrated to use pip.
TIL a couple of things about bat files. God help me.
- Use a single @echo off at the top rather than @ on every line
- Use lowercase names for builtin operation
- Use setlocal/endlocal rather than reseting EM_PYTHON at the end
This change moves the python code for emsdk into a file ending in .py.
This script is then run via emsdk.bat on windows or emsdk (a shell
script) on non-windows.
This avoid the #!/bin/sh at the top of the python script and the "exec"
hack on the first line that re-runs it under python. Hopefully this
preserves the intent of #273 without jumping through so many hoops.