Fix for `construct_env` and `list` with tot build installed (#741)
diff --git a/emsdk.py b/emsdk.py
index 69135da..c6d1f55 100644
--- a/emsdk.py
+++ b/emsdk.py
@@ -2182,6 +2182,17 @@
if extra_release_tag:
tags.append(extra_release_tag)
+ # Adds the currently installed SDK version, which might be a custom
+ # version. This means it will show up in `list` and work with
+ # `construct_env`
+ version_file = sdk_path(os.path.join('upstream', '.emsdk_version'))
+ if os.path.exists(version_file):
+ with open(version_file) as f:
+ version = f.read()
+ version = version.split('-')[2]
+ if version not in tags:
+ tags.append(version)
+
return tags, tags_fastcomp
diff --git a/scripts/test.sh b/scripts/test.sh
index 73c0d42..473dbb1 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -5,10 +5,19 @@
set -x
set -e
+# Test that arbitrary (non-released) versions can be installed and
+# activated.
+./emsdk install sdk-upstream-5c776e6a91c0cb8edafca16a652ee1ee48f4f6d2
+./emsdk activate sdk-upstream-5c776e6a91c0cb8edafca16a652ee1ee48f4f6d2
+source ./emsdk_env.sh
+which emcc
+emcc -v
+
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh --build=Release
# On mac and windows python3 should be in the path and point to the
# bundled version.
which python3
+which emcc
emcc -v