From 97fe5954deacee3c7b059e107e38d036d2b70ffe Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 21 Oct 2020 21:37:45 +0800 Subject: [PATCH] Python3 no raw_input --- tools/cocos2d-console/download-bin.py | 6 +++++- .../plugins/plugin_compile/build_android.py | 8 ++++---- tools/cocos2d-console/plugins/plugin_new/project_new.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/cocos2d-console/download-bin.py b/tools/cocos2d-console/download-bin.py index e52713bd87..31b8c7ac45 100644 --- a/tools/cocos2d-console/download-bin.py +++ b/tools/cocos2d-console/download-bin.py @@ -80,7 +80,11 @@ class CocosZipInstaller(object): print("==> version file doesn't exist") def get_input_value(self, prompt): - ret = raw_input(prompt) + ret = "" + if(sys.version_info.major >= 3): + ret = input(prompt) + else: + ret = raw_input(prompt) ret.rstrip(" \t") return ret diff --git a/tools/cocos2d-console/plugins/plugin_compile/build_android.py b/tools/cocos2d-console/plugins/plugin_compile/build_android.py index 405b8327e9..b62eda66b4 100644 --- a/tools/cocos2d-console/plugins/plugin_compile/build_android.py +++ b/tools/cocos2d-console/plugins/plugin_compile/build_android.py @@ -462,13 +462,13 @@ class AndroidBuilder(object): if build_64bit or build_other_arch: if build_64bit: if build_other_arch: - print 'build 64bit and 32bit' + print('build 64bit and 32bit') return self.LuaBuildArch.BUILD_32BIT_AND_64BIT else: - print 'only build 64bit' + print('only build 64bit') return self.LuaBuildArch.ONLY_BUILD_64BIT else: - print 'only build 32bit' + print('only build 32bit') return self.LuaBuildArch.ONLY_BUILD_32BIT return self.LuaBuildArch.UNKNOWN @@ -624,7 +624,7 @@ class AndroidBuilder(object): cocos.Logging.warning(tip_msg) ret = None while True: - ret = raw_input() + ret = cocos.get_input() break return ret diff --git a/tools/cocos2d-console/plugins/plugin_new/project_new.py b/tools/cocos2d-console/plugins/plugin_new/project_new.py index 5cc1d118db..7ff56bbf38 100644 --- a/tools/cocos2d-console/plugins/plugin_new/project_new.py +++ b/tools/cocos2d-console/plugins/plugin_new/project_new.py @@ -386,7 +386,7 @@ class Templates(object): cocos.Logging.warning('%d %s' % (i + 1, p[i])) cocos.Logging.warning(MultiLanguage.get_string('NEW_SELECT_TEMPLATE_TIP2')) while True: - option = raw_input() + option = cocos.get_input() if option.isdigit(): option = int(option) - 1 if option in range(len(p)):