Skip to content

Commit e7ca31c

Browse files
committed
[tools] Modify building.py and gcc.py for work with Python 3.
1 parent 3a63c0a commit e7ca31c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

tools/building.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def EndBuilding(target, program = None):
806806

807807
if not GetOption('help') and not GetOption('target'):
808808
if not os.path.exists(rtconfig.EXEC_PATH):
809-
print ("Error: the toolchain path ("+rtconfig.EXEC_PATH+") is not exist, please check 'EXEC_PATH' in path or rtconfig.py.")
809+
print ("Error: the toolchain path (" + rtconfig.EXEC_PATH + ") is not exist, please check 'EXEC_PATH' in path or rtconfig.py.")
810810
need_exit = True
811811

812812
if need_exit:

tools/gcc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def GetNewLibVersion(rtconfig):
5555
for line in f:
5656
if line.find('_NEWLIB_VERSION') != -1 and line.find('"') != -1:
5757
version = re.search(r'\"([^"]+)\"', line).groups()[0]
58-
f.close()
58+
f.close()
5959
elif CheckHeader(rtconfig, 'newlib.h'): # get version from newlib.h
6060
f = open(os.path.join(root, 'include', 'newlib.h'), 'r')
6161
if f:
6262
for line in f:
6363
if line.find('_NEWLIB_VERSION') != -1 and line.find('"') != -1:
6464
version = re.search(r'\"([^"]+)\"', line).groups()[0]
65-
f.close()
65+
f.close()
6666
return version
6767

6868
def GCCResult(rtconfig, str):
@@ -148,7 +148,6 @@ def checkAndGetResult(pattern, string):
148148
result += '#define LIBC_POSIX_THREADS 1\n'
149149

150150
os.remove('__tmp.c')
151-
f.close()
152151
return result
153152

154153
def GenerateGCCConfig(rtconfig):

0 commit comments

Comments
 (0)