import os import sys import subprocess if len(sys.argv) < 3: exit() if '123!@#' != sys.argv[2]: exit() ProjDir = sys.argv[1] BuildDir = ProjDir + '\\build\\web-mobile\\' SubgamePath = 's3://web-h5game-test/internal/' BundleConfig = { '6001': 'whot', '6002': 'whot', '6003': 'whot', '6005': 'BRWhot', '2001': 'roulette', '2002': 'wajeSpin', '2003': 'bottleSpin', '2004': 'blackjack', '2006': 'betterjack', '6007': 'whot', '2008': 'slots', } unlinkArray = [ 'cocos2d-js.109f3.js', 'cocos2d-js-min.13181.js', 'physics.9d2de.js', 'physics-min.ce5ee.js', 'style-desktop.dfd76.css', 'style-mobile.6e9cd.css', 'splash.85cfd.png' ] def remove_folder(path): if os.path.exists(path): if os.path.isfile(path) or os.path.islink(path): os.remove(path) else: for filename in os.listdir(path): remove_folder(os.path.join(path, filename)) os.rmdir(path) for filename in os.listdir(BuildDir): file_path = os.path.join(BuildDir, filename) if filename in unlinkArray: os.remove(file_path) for gameid in BundleConfig: awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/' subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] +'\\' cmd = 'call aws s3 cp '+ subgameDir +' '+awsPath + ' --recursive --region ap-east-1' result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True) print(result) for gameid in BundleConfig: awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/' subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] remove_folder(subgameDir) for gameid in BundleConfig: awsPath = SubgamePath + gameid + '/' cmd = 'call aws s3 cp '+ BuildDir +' '+awsPath + ' --recursive --region ap-east-1' result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True) print(result)