1#!/usr/bin/env python 2 3# Copyright 2022 Google LLC 4# 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8import os 9import subprocess 10import sys 11 12EMSDK_ROOT = os.path.join('third_party', 'externals', 'emsdk') 13 14EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') 15 16EMSDK_VERSION = '3.1.3' 17 18def main(): 19 try: 20 subprocess.check_call([sys.executable, EMSDK_PATH, 'install', EMSDK_VERSION]) 21 except subprocess.CalledProcessError: 22 print ('Failed to install emsdk') 23 return 1 24 try: 25 subprocess.check_call([sys.executable, EMSDK_PATH, 'activate', EMSDK_VERSION]) 26 except subprocess.CalledProcessError: 27 print ('Failed to activate emsdk') 28 return 1 29 30 31if __name__ == '__main__': 32 sys.exit(main())