diff options
| author | 周传福 <[email protected]> | 2019-05-16 12:22:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-16 12:22:53 +0800 |
| commit | 9329b62beff829b7e6fcfe285b4267011e6f4d5c (patch) | |
| tree | 5de4f47d6267a119bd9125c41a3f882c0a8b7b70 /tools | |
| parent | b844496ac9459a16044abe13785b355853526304 (diff) | |
| parent | 4539172f5c97306a322ac1768c5c8eb4f878ea3c (diff) | |
Merge branch 'master' into stm32_uart_tx_dma
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/menuconfig.py | 3 | ||||
| -rw-r--r-- | tools/utils.py | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/tools/menuconfig.py b/tools/menuconfig.py index 2550424802..049bc4f2ac 100644 --- a/tools/menuconfig.py +++ b/tools/menuconfig.py @@ -23,6 +23,7 @@ # 2018-07-31 weety Support pyconfig import os +import re import sys import shutil @@ -75,7 +76,7 @@ def mk_rtconfig(filename): if setting[1] == 'y': rtconfig.write('#define %s\n' % setting[0]) else: - rtconfig.write('#define %s %s\n' % (setting[0], setting[1])) + rtconfig.write('#define %s %s\n' % (setting[0], re.findall(r"^.*?=(.*)$",line)[0])) if os.path.isfile('rtconfig_project.h'): rtconfig.write('#include "rtconfig_project.h"\n') 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', '') |
