diff options
author | Hess Chen <hesheng.chen@intel.com> | 2015-06-25 08:05:42 +0000 |
---|---|---|
committer | hchen30 <hchen30@Edk2> | 2015-06-25 08:05:42 +0000 |
commit | ce2f5940060c20261a7d22f5ce5c767bb8f298b0 (patch) | |
tree | edf5f3b89344d2053ffdad0cee4f83d3d64f5ef3 /BaseTools/Source/Python/Common | |
parent | 14239f66034c9fc5ab2e8ae283f9174c4f78f360 (diff) | |
download | edk2-ce2f5940060c20261a7d22f5ce5c767bb8f298b0.tar.gz edk2-ce2f5940060c20261a7d22f5ce5c767bb8f298b0.tar.bz2 edk2-ce2f5940060c20261a7d22f5ce5c767bb8f298b0.zip |
BaseTools/Ecc: Fix a bug in parser
Fix a bug to not break when parsing a macro and not find its value
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17709 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/String.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 4dc8e9b116..6c9671d514 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -1,7 +1,7 @@ ## @file
# This file is used to define common string related functions used in parsing process
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -272,7 +272,8 @@ def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError= if SelfReplacement:
String = String.replace("$(%s)" % Macro, '')
continue
- String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
+ if "$(%s)" % Macro not in MacroDefinitions[Macro]:
+ String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
# in case there's macro not defined
if String == LastString:
break
|