From 702277a9b9a7298b3a00b6a4ed612d6fb5db4fde Mon Sep 17 00:00:00 2001 From: MurphyZhao Date: Sat, 11 May 2019 15:51:40 +0800 Subject: [PATCH] =?UTF-8?q?[tools]=20=E4=BF=AE=E5=A4=8D=20GCC=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=88=A4=E6=96=AD=E7=9A=84=E6=96=B9=E5=BC=8F=E5=B9=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MurphyZhao --- tools/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index 6dc56322a5..9459396544 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -24,6 +24,7 @@ import sys import os +import re def splitall(loc): """ @@ -245,10 +246,11 @@ def ProjectInfo(env): return proj def VersionCmp(ver1, ver2): - la=[]; + la=[] if ver1: - la = ver1.split('.') - lb = ver2.split('.') + la = re.split("[. ]", ver1) + lb = re.split("[. ]", ver2) + f = 0 if len(la) > len(lb): f = len(la) @@ -262,7 +264,7 @@ def VersionCmp(ver1, ver2): continue else: return -1 - except IndexError as e: + except (IndexError, ValueError) as e: if len(la) > len(lb): return 1 else: @@ -274,7 +276,7 @@ def GCCC99Patch(cflags): gcc_version = building.GetDepend('GCC_VERSION') if gcc_version: gcc_version = gcc_version.replace('"', '') - if VersionCmp(gcc_version, "4.8.0"): + if VersionCmp(gcc_version, "4.8.0") == 1: # remove -std=c99 after GCC 4.8.x cflags = cflags.replace('-std=c99', '')