Merge pull request #2999 from murphyzhao/tools-iar-fix

[tools][fix] 修改 iar.py 中 iar 版本查找失败后的处理
This commit is contained in:
Bernard Xiong 2019-08-26 19:09:18 +08:00 committed by GitHub
commit 40bb254ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,8 @@ import sys
import string import string
import utils import utils
from SCons.Script import *
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement from xml.etree.ElementTree import SubElement
from utils import _make_path_relative from utils import _make_path_relative
@ -194,10 +196,13 @@ def IARVersion():
cmd = os.path.join(path, 'iccarm.exe') cmd = os.path.join(path, 'iccarm.exe')
else: else:
print('Error: get IAR version failed. Please update the IAR installation path in rtconfig.py!') print('Error: get IAR version failed. Please update the IAR installation path in rtconfig.py!')
return "0.0" exit(-1)
child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = child.communicate() stdout, stderr = child.communicate()
# example stdout: IAR ANSI C/C++ Compiler V8.20.1.14183/W32 for ARM # example stdout: IAR ANSI C/C++ Compiler V8.20.1.14183/W32 for ARM
return re.search('[\d\.]+', stdout).group(0) iar_version = re.search('[\d\.]+', stdout).group(0)
if GetOption('verbose'):
print("IAR version: %s" % iar_version)
return iar_version