summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/AutoGen.py
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-04-06 07:13:57 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-04-10 10:05:14 +0800
commit339fe8dd6a4e756f87825c8f1dd5c38204951985 (patch)
tree037c62f19338c604ced68a988ddb4586d5dca01b /BaseTools/Source/Python/AutoGen/AutoGen.py
parent6be947438f746baf16afe290ec4ca23ade71400f (diff)
downloadedk2-339fe8dd6a4e756f87825c8f1dd5c38204951985.tar.gz
edk2-339fe8dd6a4e756f87825c8f1dd5c38204951985.tar.bz2
edk2-339fe8dd6a4e756f87825c8f1dd5c38204951985.zip
BaseTools: optimize buildoptions loop
change a dict to a double defaultdict to prevent needing to seed innter values. move "Value" determination under a conditional continue statement Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/AutoGen.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 562f3f63fc..9c976c3727 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2686,40 +2686,31 @@ class PlatformAutoGen(AutoGen):
AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() +
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +
self.ToolDefinition.keys())
- BuildOptions = {}
+ BuildOptions = defaultdict(lambda: defaultdict(str))
for Tool in AllTools:
- if Tool not in BuildOptions:
- BuildOptions[Tool] = {}
-
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
if Tool not in Options:
continue
for Attr in Options[Tool]:
- Value = Options[Tool][Attr]
#
# Do not generate it in Makefile
#
if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
continue
- if Attr not in BuildOptions[Tool]:
- BuildOptions[Tool][Attr] = ""
+ Value = Options[Tool][Attr]
# check if override is indicated
if Value.startswith('='):
- ToolPath = Value[1:]
- ToolPath = mws.handleWsMacro(ToolPath)
- BuildOptions[Tool][Attr] = ToolPath
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
else:
- Value = mws.handleWsMacro(Value)
if Attr != 'PATH':
- BuildOptions[Tool][Attr] += " " + Value
+ BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
else:
- BuildOptions[Tool][Attr] = Value
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
+
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:
#
# Override UNI flag only for EDK module.
#
- if 'BUILD' not in BuildOptions:
- BuildOptions['BUILD'] = {}
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
return BuildOptions, BuildRuleOrder