From e7ca31ccaa46fa30564b136dc33daa08d8397b2c Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Wed, 7 Nov 2018 13:40:41 +0800 Subject: [PATCH] [tools] Modify building.py and gcc.py for work with Python 3. --- tools/building.py | 2 +- tools/gcc.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/building.py b/tools/building.py index afb896f7bf..18ec7f1883 100644 --- a/tools/building.py +++ b/tools/building.py @@ -806,7 +806,7 @@ def EndBuilding(target, program = None): if not GetOption('help') and not GetOption('target'): if not os.path.exists(rtconfig.EXEC_PATH): - print ("Error: the toolchain path ("+rtconfig.EXEC_PATH+") is not exist, please check 'EXEC_PATH' in path or rtconfig.py.") + print ("Error: the toolchain path (" + rtconfig.EXEC_PATH + ") is not exist, please check 'EXEC_PATH' in path or rtconfig.py.") need_exit = True if need_exit: diff --git a/tools/gcc.py b/tools/gcc.py index 8bc2dcf7a8..90e5a7dba8 100644 --- a/tools/gcc.py +++ b/tools/gcc.py @@ -55,14 +55,14 @@ def GetNewLibVersion(rtconfig): for line in f: if line.find('_NEWLIB_VERSION') != -1 and line.find('"') != -1: version = re.search(r'\"([^"]+)\"', line).groups()[0] - f.close() + f.close() elif CheckHeader(rtconfig, 'newlib.h'): # get version from newlib.h f = open(os.path.join(root, 'include', 'newlib.h'), 'r') if f: for line in f: if line.find('_NEWLIB_VERSION') != -1 and line.find('"') != -1: version = re.search(r'\"([^"]+)\"', line).groups()[0] - f.close() + f.close() return version def GCCResult(rtconfig, str): @@ -148,7 +148,6 @@ def GCCResult(rtconfig, str): result += '#define LIBC_POSIX_THREADS 1\n' os.remove('__tmp.c') - f.close() return result def GenerateGCCConfig(rtconfig):