diff options
author | Carsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben> | 2018-04-05 04:56:56 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-08 16:33:03 +0800 |
commit | ff5635e9acbf8a4d0c4095e78f72f97ae94ce43b (patch) | |
tree | 587b0ca9451913658cd6017abe2823e020614d98 /BaseTools/Source/Python/AutoGen | |
parent | e6c2468a9e6158b6bf669f05129a1dd362d52753 (diff) | |
download | edk2-ff5635e9acbf8a4d0c4095e78f72f97ae94ce43b.tar.gz edk2-ff5635e9acbf8a4d0c4095e78f72f97ae94ce43b.tar.bz2 edk2-ff5635e9acbf8a4d0c4095e78f72f97ae94ce43b.zip |
BaseTools: Autogen - change from list to set
by changing from list to set(), we can skip all the preprocessing
to prevent duplication and we dont need to convert to a set() later
on for each use
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')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 4088fb9c8b..ef2e3ebe85 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -415,8 +415,8 @@ class WorkspaceAutoGen(AutoGen): - SourcePcdDict = {'DynamicEx':[], 'PatchableInModule':[],'Dynamic':[],'FixedAtBuild':[]}
- BinaryPcdDict = {'DynamicEx':[], 'PatchableInModule':[]}
+ SourcePcdDict = {'DynamicEx':set(), 'PatchableInModule':set(),'Dynamic':set(),'FixedAtBuild':set()}
+ BinaryPcdDict = {'DynamicEx':set(), 'PatchableInModule':set()}
SourcePcdDict_Keys = SourcePcdDict.keys()
BinaryPcdDict_Keys = BinaryPcdDict.keys()
@@ -442,27 +442,21 @@ class WorkspaceAutoGen(AutoGen): if 'DynamicEx' in BuildData.Pcds[key].Type:
if BuildData.IsBinaryModule:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in BinaryPcdDict['DynamicEx']:
- BinaryPcdDict['DynamicEx'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ BinaryPcdDict['DynamicEx'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
else:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in SourcePcdDict['DynamicEx']:
- SourcePcdDict['DynamicEx'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ SourcePcdDict['DynamicEx'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
elif 'PatchableInModule' in BuildData.Pcds[key].Type:
if BuildData.MetaFile.Ext == '.inf':
if BuildData.IsBinaryModule:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in BinaryPcdDict['PatchableInModule']:
- BinaryPcdDict['PatchableInModule'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ BinaryPcdDict['PatchableInModule'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
else:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in SourcePcdDict['PatchableInModule']:
- SourcePcdDict['PatchableInModule'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ SourcePcdDict['PatchableInModule'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
elif 'Dynamic' in BuildData.Pcds[key].Type:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in SourcePcdDict['Dynamic']:
- SourcePcdDict['Dynamic'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ SourcePcdDict['Dynamic'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
elif 'FixedAtBuild' in BuildData.Pcds[key].Type:
- if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in SourcePcdDict['FixedAtBuild']:
- SourcePcdDict['FixedAtBuild'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ SourcePcdDict['FixedAtBuild'].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
else:
pass
#
@@ -471,13 +465,13 @@ class WorkspaceAutoGen(AutoGen): for i in SourcePcdDict_Keys:
for j in SourcePcdDict_Keys:
if i != j:
- IntersectionList = list(set(SourcePcdDict[i]).intersection(set(SourcePcdDict[j])))
- if len(IntersectionList) > 0:
+ Intersections = SourcePcdDict[i].intersection(SourcePcdDict[j])
+ if len(Intersections) > 0:
EdkLogger.error(
'build',
FORMAT_INVALID,
"Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j),
- ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) for P in IntersectionList])
+ ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) for P in Intersections])
)
else:
pass
@@ -488,8 +482,8 @@ class WorkspaceAutoGen(AutoGen): for i in BinaryPcdDict_Keys:
for j in BinaryPcdDict_Keys:
if i != j:
- IntersectionList = list(set(BinaryPcdDict[i]).intersection(set(BinaryPcdDict[j])))
- for item in IntersectionList:
+ Intersections = BinaryPcdDict[i].intersection(BinaryPcdDict[j])
+ for item in Intersections:
NewPcd1 = (item[0] + '_' + i, item[1])
NewPcd2 = (item[0] + '_' + j, item[1])
if item not in GlobalData.MixedPcd:
@@ -508,8 +502,8 @@ class WorkspaceAutoGen(AutoGen): for i in SourcePcdDict_Keys:
for j in BinaryPcdDict_Keys:
if i != j:
- IntersectionList = list(set(SourcePcdDict[i]).intersection(set(BinaryPcdDict[j])))
- for item in IntersectionList:
+ Intersections = SourcePcdDict[i].intersection(BinaryPcdDict[j])
+ for item in Intersections:
NewPcd1 = (item[0] + '_' + i, item[1])
NewPcd2 = (item[0] + '_' + j, item[1])
if item not in GlobalData.MixedPcd:
|