X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FWorkspace%2FInfBuildData.py;h=f79ffe28d804b148e4bc554e6f9c73f648283143;hp=157f7a2d2de8ecac863b9981333bcd1faf3a253e;hb=1100bc5aa05097306cdecc4d0118cc312da79d45;hpb=be409b67566348f75b69e66ef9604b248e053553 diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 157f7a2d2d..f79ffe28d8 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -12,11 +12,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -from Common.String import * +from __future__ import absolute_import +from Common.StringUtils import * from Common.DataType import * from Common.Misc import * from types import * -from MetaFileParser import * +from .MetaFileParser import * from collections import OrderedDict from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject @@ -71,7 +72,7 @@ class InfBuildData(ModuleBuildClassObject): # dict used to convert old tool name used in [nmake] section to new ones _TOOL_CODE_ = { "C" : "CC", - "LIB" : "SLINK", + BINARY_FILE_TYPE_LIB : "SLINK", "LINK" : "DLINK", } @@ -698,7 +699,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Protocol [%s] is not found under [Protocols] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -723,7 +724,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = PpiValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of PPI [%s] is not found under [Ppis] section in " % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -748,7 +749,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = GuidValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -918,7 +919,7 @@ class InfBuildData(ModuleBuildClassObject): if Value is None: Value = GuidValue(Token, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of [%s] is not found in" % Token, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -961,7 +962,7 @@ class InfBuildData(ModuleBuildClassObject): if TokenSpaceGuid not in self.Guids: Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid, ExtraData=PackageList, File=self.MetaFile, Line=LineNo) @@ -1116,12 +1117,12 @@ class InfBuildData(ModuleBuildClassObject): Pcd.DatumType = PcdInPackage.DatumType Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize Pcd.InfDefaultValue = Pcd.DefaultValue - if Pcd.DefaultValue in [None, '']: + if not Pcd.DefaultValue: Pcd.DefaultValue = PcdInPackage.DefaultValue else: try: Pcd.DefaultValue = ValueExpressionEx(Pcd.DefaultValue, Pcd.DatumType, _GuidDict)(True) - except BadExpression, Value: + except BadExpression as Value: EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid, PcdRealName, Pcd.DefaultValue, Value), File=self.MetaFile, Line=LineNo) break @@ -1131,7 +1132,7 @@ class InfBuildData(ModuleBuildClassObject): FORMAT_INVALID, "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid, PcdRealName, self.MetaFile), File=self.MetaFile, Line=LineNo, - ExtraData="\t%s" % '\n\t'.join([str(P) for P in self.Packages]) + ExtraData="\t%s" % '\n\t'.join(str(P) for P in self.Packages) ) Pcds[PcdCName, TokenSpaceGuid] = Pcd