summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-03-27 04:25:43 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-03-30 08:25:13 +0800
commit4231a8193ec0d52df7e0a101d96c51b1a2b7a996 (patch)
tree4fc8e46c9d51a4938e891e6b029781f1b66537ae /BaseTools/Source/Python/Workspace
parent05a32984ab799a564e2eeb7dff128fe0992910d8 (diff)
downloadedk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.gz
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.bz2
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.zip
BaseTools: Remove equality operator with None
replace "== None" with "is None" and "!= None" with "is not None" Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@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/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/BuildClassObject.py2
-rw-r--r--BaseTools/Source/Python/Workspace/DecBuildData.py36
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py158
-rw-r--r--BaseTools/Source/Python/Workspace/InfBuildData.py190
-rw-r--r--BaseTools/Source/Python/Workspace/MetaDataTable.py4
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py10
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileTable.py16
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceCommon.py12
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py6
9 files changed, 217 insertions, 217 deletions
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index a306dc0b23..90c8246806 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -212,7 +212,7 @@ class LibraryClassObject(object):
def __init__(self, Name = None, SupModList = [], Type = None):
self.LibraryClass = Name
self.SupModList = SupModList
- if Type != None:
+ if Type is not None:
self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)
## ModuleBuildClassObject
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 4d6edadc8f..49ef1df4aa 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -107,7 +107,7 @@ class DecBuildData(PackageBuildClassObject):
## Get current effective macros
def _GetMacros(self):
- if self.__Macros == None:
+ if self.__Macros is None:
self.__Macros = {}
self.__Macros.update(GlobalData.gGlobalDefines)
return self.__Macros
@@ -145,34 +145,34 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve package name
def _GetPackageName(self):
- if self._PackageName == None:
- if self._Header == None:
+ if self._PackageName is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._PackageName == None:
+ if self._PackageName is None:
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_NAME", File=self.MetaFile)
return self._PackageName
## Retrieve file guid
def _GetFileGuid(self):
- if self._Guid == None:
- if self._Header == None:
+ if self._Guid is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Guid == None:
+ if self._Guid is None:
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_GUID", File=self.MetaFile)
return self._Guid
## Retrieve package version
def _GetVersion(self):
- if self._Version == None:
- if self._Header == None:
+ if self._Version is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Version == None:
+ if self._Version is None:
self._Version = ''
return self._Version
## Retrieve protocol definitions (name/value pairs)
def _GetProtocol(self):
- if self._Protocols == None:
+ if self._Protocols is None:
#
# tdict is a special kind of dict, used for selecting correct
# protocol defition for given ARCH
@@ -214,7 +214,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve PPI definitions (name/value pairs)
def _GetPpi(self):
- if self._Ppis == None:
+ if self._Ppis is None:
#
# tdict is a special kind of dict, used for selecting correct
# PPI defition for given ARCH
@@ -256,7 +256,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve GUID definitions (name/value pairs)
def _GetGuid(self):
- if self._Guids == None:
+ if self._Guids is None:
#
# tdict is a special kind of dict, used for selecting correct
# GUID defition for given ARCH
@@ -298,7 +298,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve public include paths declared in this package
def _GetInclude(self):
- if self._Includes == None or self._CommonIncludes is None:
+ if self._Includes is None or self._CommonIncludes is None:
self._CommonIncludes = []
self._Includes = []
self._PrivateIncludes = []
@@ -333,7 +333,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve library class declarations (not used in build at present)
def _GetLibraryClass(self):
- if self._LibraryClasses == None:
+ if self._LibraryClasses is None:
#
# tdict is a special kind of dict, used for selecting correct
# library class declaration for given ARCH
@@ -357,7 +357,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve PCD declarations
def _GetPcds(self):
- if self._Pcds == None:
+ if self._Pcds is None:
self._Pcds = sdict()
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
@@ -422,7 +422,7 @@ class DecBuildData(PackageBuildClassObject):
# will automatically turn to 'common' ARCH and try again
#
Setting,LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]
- if Setting == None:
+ if Setting is None:
continue
DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)
@@ -454,7 +454,7 @@ class DecBuildData(PackageBuildClassObject):
StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')
for pcd in Pcds.values():
if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
- if StructPattern.match(pcd.DatumType) == None:
+ if StructPattern.match(pcd.DatumType) is None:
EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", pcd.DefinitionPosition[0],pcd.DefinitionPosition[1])
for struct_pcd in Pcds.values():
if isinstance(struct_pcd,StructurePcd) and not struct_pcd.StructuredPcdIncludeFile:
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1cc4dc9662..cf96086512 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -298,7 +298,7 @@ class DscBuildData(PlatformBuildClassObject):
## Get current effective macros
def _GetMacros(self):
- if self.__Macros == None:
+ if self.__Macros is None:
self.__Macros = {}
self.__Macros.update(GlobalData.gPlatformDefines)
self.__Macros.update(GlobalData.gGlobalDefines)
@@ -368,7 +368,7 @@ class DscBuildData(PlatformBuildClassObject):
elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
self._BuildTargets = GetSplitValueList(Record[2])
elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
- if self._SkuName == None:
+ if self._SkuName is None:
self._SkuName = Record[2]
if GlobalData.gSKUID_CMD:
self._SkuName = GlobalData.gSKUID_CMD
@@ -427,76 +427,76 @@ class DscBuildData(PlatformBuildClassObject):
## Retrieve platform name
def _GetPlatformName(self):
- if self._PlatformName == None:
- if self._Header == None:
+ if self._PlatformName is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._PlatformName == None:
+ if self._PlatformName is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_NAME", File=self.MetaFile)
return self._PlatformName
## Retrieve file guid
def _GetFileGuid(self):
- if self._Guid == None:
- if self._Header == None:
+ if self._Guid is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Guid == None:
+ if self._Guid is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_GUID", File=self.MetaFile)
return self._Guid
## Retrieve platform version
def _GetVersion(self):
- if self._Version == None:
- if self._Header == None:
+ if self._Version is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Version == None:
+ if self._Version is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_VERSION", File=self.MetaFile)
return self._Version
## Retrieve platform description file version
def _GetDscSpec(self):
- if self._DscSpecification == None:
- if self._Header == None:
+ if self._DscSpecification is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._DscSpecification == None:
+ if self._DscSpecification is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No DSC_SPECIFICATION", File=self.MetaFile)
return self._DscSpecification
## Retrieve OUTPUT_DIRECTORY
def _GetOutpuDir(self):
- if self._OutputDirectory == None:
- if self._Header == None:
+ if self._OutputDirectory is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._OutputDirectory == None:
+ if self._OutputDirectory is None:
self._OutputDirectory = os.path.join("Build", self._PlatformName)
return self._OutputDirectory
## Retrieve SUPPORTED_ARCHITECTURES
def _GetSupArch(self):
- if self._SupArchList == None:
- if self._Header == None:
+ if self._SupArchList is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._SupArchList == None:
+ if self._SupArchList is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No SUPPORTED_ARCHITECTURES", File=self.MetaFile)
return self._SupArchList
## Retrieve BUILD_TARGETS
def _GetBuildTarget(self):
- if self._BuildTargets == None:
- if self._Header == None:
+ if self._BuildTargets is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._BuildTargets == None:
+ if self._BuildTargets is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BUILD_TARGETS", File=self.MetaFile)
return self._BuildTargets
def _GetPcdInfoFlag(self):
- if self._PcdInfoFlag == None or self._PcdInfoFlag.upper() == 'FALSE':
+ if self._PcdInfoFlag is None or self._PcdInfoFlag.upper() == 'FALSE':
return False
elif self._PcdInfoFlag.upper() == 'TRUE':
return True
else:
return False
def _GetVarCheckFlag(self):
- if self._VarCheckFlag == None or self._VarCheckFlag.upper() == 'FALSE':
+ if self._VarCheckFlag is None or self._VarCheckFlag.upper() == 'FALSE':
return False
elif self._VarCheckFlag.upper() == 'TRUE':
return True
@@ -505,10 +505,10 @@ class DscBuildData(PlatformBuildClassObject):
# # Retrieve SKUID_IDENTIFIER
def _GetSkuName(self):
- if self._SkuName == None:
- if self._Header == None:
+ if self._SkuName is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._SkuName == None:
+ if self._SkuName is None:
self._SkuName = 'DEFAULT'
return self._SkuName
@@ -517,72 +517,72 @@ class DscBuildData(PlatformBuildClassObject):
self._SkuName = Value
def _GetFdfFile(self):
- if self._FlashDefinition == None:
- if self._Header == None:
+ if self._FlashDefinition is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._FlashDefinition == None:
+ if self._FlashDefinition is None:
self._FlashDefinition = ''
return self._FlashDefinition
def _GetPrebuild(self):
- if self._Prebuild == None:
- if self._Header == None:
+ if self._Prebuild is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Prebuild == None:
+ if self._Prebuild is None:
self._Prebuild = ''
return self._Prebuild
def _GetPostbuild(self):
- if self._Postbuild == None:
- if self._Header == None:
+ if self._Postbuild is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._Postbuild == None:
+ if self._Postbuild is None:
self._Postbuild = ''
return self._Postbuild
## Retrieve FLASH_DEFINITION
def _GetBuildNumber(self):
- if self._BuildNumber == None:
- if self._Header == None:
+ if self._BuildNumber is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._BuildNumber == None:
+ if self._BuildNumber is None:
self._BuildNumber = ''
return self._BuildNumber
## Retrieve MAKEFILE_NAME
def _GetMakefileName(self):
- if self._MakefileName == None:
- if self._Header == None:
+ if self._MakefileName is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._MakefileName == None:
+ if self._MakefileName is None:
self._MakefileName = ''
return self._MakefileName
## Retrieve BsBaseAddress
def _GetBsBaseAddress(self):
- if self._BsBaseAddress == None:
- if self._Header == None:
+ if self._BsBaseAddress is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._BsBaseAddress == None:
+ if self._BsBaseAddress is None:
self._BsBaseAddress = ''
return self._BsBaseAddress
## Retrieve RtBaseAddress
def _GetRtBaseAddress(self):
- if self._RtBaseAddress == None:
- if self._Header == None:
+ if self._RtBaseAddress is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._RtBaseAddress == None:
+ if self._RtBaseAddress is None:
self._RtBaseAddress = ''
return self._RtBaseAddress
## Retrieve the top address for the load fix address
def _GetLoadFixAddress(self):
- if self._LoadFixAddress == None:
- if self._Header == None:
+ if self._LoadFixAddress is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._LoadFixAddress == None:
+ if self._LoadFixAddress is None:
self._LoadFixAddress = self._Macros.get(TAB_FIX_LOAD_TOP_MEMORY_ADDRESS, '0')
try:
@@ -608,33 +608,33 @@ class DscBuildData(PlatformBuildClassObject):
## Retrieve RFCLanguage filter
def _GetRFCLanguages(self):
- if self._RFCLanguages == None:
- if self._Header == None:
+ if self._RFCLanguages is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._RFCLanguages == None:
+ if self._RFCLanguages is None:
self._RFCLanguages = []
return self._RFCLanguages
## Retrieve ISOLanguage filter
def _GetISOLanguages(self):
- if self._ISOLanguages == None:
- if self._Header == None:
+ if self._ISOLanguages is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._ISOLanguages == None:
+ if self._ISOLanguages is None:
self._ISOLanguages = []
return self._ISOLanguages
## Retrieve the GUID string for VPD tool
def _GetVpdToolGuid(self):
- if self._VpdToolGuid == None:
- if self._Header == None:
+ if self._VpdToolGuid is None:
+ if self._Header is None:
self._GetHeaderInfo()
- if self._VpdToolGuid == None:
+ if self._VpdToolGuid is None:
self._VpdToolGuid = ''
return self._VpdToolGuid
## Retrieve [SkuIds] section information
def _GetSkuIds(self):
- if self._SkuIds == None:
+ if self._SkuIds is None:
self._SkuIds = sdict()
RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]
for Record in RecordList:
@@ -646,7 +646,7 @@ class DscBuildData(PlatformBuildClassObject):
File=self.MetaFile, Line=Record[-1])
Pattern = re.compile('^[1-9]\d*|0$')
HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
- if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:
+ if Pattern.match(Record[0]) is None and HexPattern.match(Record[0]) is None:
EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",
File=self.MetaFile, Line=Record[-1])
if not IsValidWord(Record[1]):
@@ -661,7 +661,7 @@ class DscBuildData(PlatformBuildClassObject):
def ToInt(self,intstr):
return int(intstr,16) if intstr.upper().startswith("0X") else int(intstr)
def _GetDefaultStores(self):
- if self.DefaultStores == None:
+ if self.DefaultStores is None:
self.DefaultStores = sdict()
RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]
for Record in RecordList:
@@ -673,7 +673,7 @@ class DscBuildData(PlatformBuildClassObject):
File=self.MetaFile, Line=Record[-1])
Pattern = re.compile('^[1-9]\d*|0$')
HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
- if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:
+ if Pattern.match(Record[0]) is None and HexPattern.match(Record[0]) is None:
EdkLogger.error('build', FORMAT_INVALID, "The format of the DefaultStores ID number is invalid. It only support Integer and HexNumber",
File=self.MetaFile, Line=Record[-1])
if not IsValidWord(Record[1]):
@@ -689,7 +689,7 @@ class DscBuildData(PlatformBuildClassObject):
## Retrieve [Components] section information
def _GetModules(self):
- if self._Modules != None:
+ if self._Modules is not None:
return self._Modules
self._Modules = sdict()
@@ -788,13 +788,13 @@ class DscBuildData(PlatformBuildClassObject):
## Retrieve all possible library instances used in this platform
def _GetLibraryInstances(self):
- if self._LibraryInstances == None:
+ if self._LibraryInstances is None:
self._GetLibraryClasses()
return self._LibraryInstances
## Retrieve [LibraryClasses] information
def _GetLibraryClasses(self):
- if self._LibraryClasses == None:
+ if self._LibraryClasses is None:
self._LibraryInstances = []
#
# tdict is a special dict kind of type, used for selecting correct
@@ -832,7 +832,7 @@ class DscBuildData(PlatformBuildClassObject):
# try all possible module types
for ModuleType in SUP_MODULE_LIST:
LibraryInstance = LibraryClassDict[self._Arch, ModuleType, LibraryClass]
- if LibraryInstance == None:
+ if LibraryInstance is None:
continue
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
@@ -859,7 +859,7 @@ class DscBuildData(PlatformBuildClassObject):
return self._LibraryClasses
def _ValidatePcd(self, PcdCName, TokenSpaceGuid, Setting, PcdType, LineNo):
- if self._DecPcds == None:
+ if self._DecPcds is None:
FdfInfList = []
if GlobalData.gFdfParser:
@@ -1121,7 +1121,7 @@ class DscBuildData(PlatformBuildClassObject):
## Retrieve all PCD settings in platform
def _GetPcds(self):
- if self._Pcds == None:
+ if self._Pcds is None:
self._Pcds = sdict()
self.__ParsePcdFromCommandLine()
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
@@ -1156,7 +1156,7 @@ class DscBuildData(PlatformBuildClassObject):
print "PcdCName: %s, SkuName: %s, Value: %s" % (".".join((pcdobj.TokenSpaceGuidCName, pcdobj.TokenCName)), skuid,str(pcdobj.SkuInfoList[skuid].DefaultValue))
## Retrieve [BuildOptions]
def _GetBuildOptions(self):
- if self._BuildOptions == None:
+ if self._BuildOptions is None:
self._BuildOptions = sdict()
#
# Retrieve build option for EDKII and EDK style module
@@ -1178,7 +1178,7 @@ class DscBuildData(PlatformBuildClassObject):
return self._BuildOptions
def GetBuildOptionsByModuleType(self, Edk, ModuleType):
- if self._ModuleTypeOptions == None:
+ if self._ModuleTypeOptions is None:
self._ModuleTypeOptions = sdict()
if (Edk, ModuleType) not in self._ModuleTypeOptions:
options = sdict()
@@ -1471,7 +1471,7 @@ class DscBuildData(PlatformBuildClassObject):
for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet:
Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName]
- if Setting == None:
+ if Setting is None:
continue
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
if (PcdCName, TokenSpaceGuid) in PcdValueDict:
@@ -2256,7 +2256,7 @@ class DscBuildData(PlatformBuildClassObject):
for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
- if Setting == None:
+ if Setting is None:
continue
PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
@@ -2428,7 +2428,7 @@ class DscBuildData(PlatformBuildClassObject):
for PcdCName, TokenSpaceGuid, SkuName,DefaultStore, Dummy4 in PcdSet:
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid,DefaultStore]
- if Setting == None:
+ if Setting is None:
continue
VariableName, VariableGuid, VariableOffset, DefaultValue, VarAttribute = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
@@ -2498,7 +2498,7 @@ class DscBuildData(PlatformBuildClassObject):
pcd.DatumType = pcdDecObject.DatumType
# Only fix the value while no value provided in DSC file.
for sku in pcd.SkuInfoList.values():
- if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue == None):
+ if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue is None):
sku.HiiDefaultValue = pcdDecObject.DefaultValue
for default_store in sku.DefaultStoreDict:
sku.DefaultStoreDict[default_store]=pcdDecObject.DefaultValue
@@ -2582,7 +2582,7 @@ class DscBuildData(PlatformBuildClassObject):
# Remove redundant PCD candidates, per the ARCH and SKU
for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
- if Setting == None:
+ if Setting is None:
continue
#
# For the VOID* type, it can have optional data of MaxDatumSize and InitialValue
@@ -2691,7 +2691,7 @@ class DscBuildData(PlatformBuildClassObject):
self.Pcds[Name, Guid].DefaultValue = Value
@property
def DecPcds(self):
- if self._DecPcds == None:
+ if self._DecPcds is None:
FdfInfList = []
if GlobalData.gFdfParser:
FdfInfList = GlobalData.gFdfParser.Profile.InfList
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 7ea9b56d5d..ded8f610c9 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -179,7 +179,7 @@ class InfBuildData(ModuleBuildClassObject):
## Get current effective macros
def _GetMacros(self):
- if self.__Macros == None:
+ if self.__Macros is None:
self.__Macros = {}
# EDK_GLOBAL defined macros can be applied to EDK module
if self.AutoGenVersion < 0x00010005:
@@ -246,7 +246,7 @@ class InfBuildData(ModuleBuildClassObject):
# items defined _PROPERTY_ don't need additional processing
if Name in self:
self[Name] = Value
- if self._Defs == None:
+ if self._Defs is None:
self._Defs = sdict()
self._Defs[Name] = Value
self._Macros[Name] = Value
@@ -254,15 +254,15 @@ class InfBuildData(ModuleBuildClassObject):
elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
Name = 'UEFI_SPECIFICATION_VERSION'
- if self._Specification == None:
+ if self._Specification is None:
self._Specification = sdict()
self._Specification[Name] = GetHexVerValue(Value)
- if self._Specification[Name] == None:
+ if self._Specification[Name] is None:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
"'%s' format is not supported for %s" % (Value, Name),
File=self.MetaFile, Line=Record[-1])
elif Name == 'LIBRARY_CLASS':
- if self._LibraryClass == None:
+ if self._LibraryClass is None:
self._LibraryClass = []
ValueList = GetSplitValueList(Value)
LibraryClass = ValueList[0]
@@ -272,30 +272,30 @@ class InfBuildData(ModuleBuildClassObject):
SupModuleList = SUP_MODULE_LIST
self._LibraryClass.append(LibraryClassObject(LibraryClass, SupModuleList))
elif Name == 'ENTRY_POINT':
- if self._ModuleEntryPointList == None:
+ if self._ModuleEntryPointList is None:
self._ModuleEntryPointList = []
self._ModuleEntryPointList.append(Value)
elif Name == 'UNLOAD_IMAGE':
- if self._ModuleUnloadImageList == None:
+ if self._ModuleUnloadImageList is None:
self._ModuleUnloadImageList = []
if not Value:
continue
self._ModuleUnloadImageList.append(Value)
elif Name == 'CONSTRUCTOR':
- if self._ConstructorList == None:
+ if self._ConstructorList is None:
self._ConstructorList = []
if not Value:
continue
self._ConstructorList.append(Value)
elif Name == 'DESTRUCTOR':
- if self._DestructorList == None:
+ if self._DestructorList is None:
self._DestructorList = []
if not Value:
continue
self._DestructorList.append(Value)
elif Name == TAB_INF_DEFINES_CUSTOM_MAKEFILE:
TokenList = GetSplitValueList(Value)
- if self._CustomMakefile == None:
+ if self._CustomMakefile is None:
self._CustomMakefile = {}
if len(TokenList) < 2:
self._CustomMakefile['MSFT'] = TokenList[0]
@@ -307,7 +307,7 @@ class InfBuildData(ModuleBuildClassObject):
File=self.MetaFile, Line=Record[-1])
self._CustomMakefile[TokenList[0]] = TokenList[1]
else:
- if self._Defs == None:
+ if self._Defs is None:
self._Defs = sdict()
self._Defs[Name] = Value
self._Macros[Name] = Value
@@ -329,10 +329,10 @@ class InfBuildData(ModuleBuildClassObject):
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
"MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
File=self.MetaFile, Line=LineNo)
- if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
if self._ModuleType == SUP_MODULE_SMM_CORE:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
- if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
if self._ModuleType == SUP_MODULE_MM_STANDALONE:
@@ -357,7 +357,7 @@ class InfBuildData(ModuleBuildClassObject):
if ErrorCode != 0:
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
File=self.MetaFile, Line=LineNo)
- if self.Sources == None:
+ if self.Sources is None:
self._Sources = []
self._Sources.append(File)
else:
@@ -377,7 +377,7 @@ class InfBuildData(ModuleBuildClassObject):
for Name, Value, Dummy, Arch, Platform, ID, LineNo in RecordList:
Value = ReplaceMacro(Value, Macros, True)
if Name == "IMAGE_ENTRY_POINT":
- if self._ModuleEntryPointList == None:
+ if self._ModuleEntryPointList is None:
self._ModuleEntryPointList = []
self._ModuleEntryPointList.append(Value)
elif Name == "DPX_SOURCE":
@@ -387,7 +387,7 @@ class InfBuildData(ModuleBuildClassObject):
if ErrorCode != 0:
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
File=self.MetaFile, Line=LineNo)
- if self.Sources == None:
+ if self.Sources is None:
self._Sources = []
self._Sources.append(File)
else:
@@ -397,7 +397,7 @@ class InfBuildData(ModuleBuildClassObject):
# EdkLogger.warn("build", "Don't know how to do with macro [%s]" % Name,
# File=self.MetaFile, Line=LineNo)
else:
- if self._BuildOptions == None:
+ if self._BuildOptions is None:
self._BuildOptions = sdict()
if ToolList[0] in self._TOOL_CODE_:
@@ -424,7 +424,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve file version
def _GetInfVersion(self):
- if self._AutoGenVersion == None:
+ if self._AutoGenVersion is None:
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
for Record in RecordList:
if Record[1] == TAB_INF_DEFINES_INF_VERSION:
@@ -436,34 +436,34 @@ class InfBuildData(ModuleBuildClassObject):
else:
self._AutoGenVersion = int(Record[2], 0)
break
- if self._AutoGenVersion == None:
+ if self._AutoGenVersion is None:
self._AutoGenVersion = 0x00010000
return self._AutoGenVersion
## Retrieve BASE_NAME
def _GetBaseName(self):
- if self._BaseName == None:
- if self._Header_ == None:
+ if self._BaseName is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._BaseName == None:
+ if self._BaseName is None:
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BASE_NAME name", File=self.MetaFile)
return self._BaseName
## Retrieve DxsFile
def _GetDxsFile(self):
- if self._DxsFile == None:
- if self._Header_ == None:
+ if self._DxsFile is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._DxsFile == None:
+ if self._DxsFile is None:
self._DxsFile = ''
return self._DxsFile
## Retrieve MODULE_TYPE
def _GetModuleType(self):
- if self._ModuleType == None:
- if self._Header_ == None:
+ if self._ModuleType is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._ModuleType == None:
+ if self._ModuleType is None:
self._ModuleType = 'BASE'
if self._ModuleType not in SUP_MODULE_LIST:
self._ModuleType = "USER_DEFINED"
@@ -471,17 +471,17 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve COMPONENT_TYPE
def _GetComponentType(self):
- if self._ComponentType == None:
- if self._Header_ == None:
+ if self._ComponentType is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._ComponentType == None:
+ if self._ComponentType is None:
self._ComponentType = 'USER_DEFINED'
return self._ComponentType
## Retrieve "BUILD_TYPE"
def _GetBuildType(self):
- if self._BuildType == None:
- if self._Header_ == None:
+ if self._BuildType is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
if not self._BuildType:
self._BuildType = "BASE"
@@ -489,37 +489,37 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve file guid
def _GetFileGuid(self):
- if self._Guid == None:
- if self._Header_ == None:
+ if self._Guid is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._Guid == None:
+ if self._Guid is None:
self._Guid = '00000000-0000-0000-0000-000000000000'
return self._Guid
## Retrieve module version
def _GetVersion(self):
- if self._Version == None:
- if self._Header_ == None:
+ if self._Version is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._Version == None:
+ if self._Version is None:
self._Version = '0.0'
return self._Version
## Retrieve PCD_IS_DRIVER
def _GetPcdIsDriver(self):
- if self._PcdIsDriver == None:
- if self._Header_ == None:
+ if self._PcdIsDriver is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._PcdIsDriver == None:
+ if self._PcdIsDriver is None:
self._PcdIsDriver = ''
return self._PcdIsDriver
## Retrieve SHADOW
def _GetShadow(self):
- if self._Shadow == None:
- if self._Header_ == None:
+ if self._Shadow is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._Shadow != None and self._Shadow.upper() == 'TRUE':
+ if self._Shadow is not None and self._Shadow.upper() == 'TRUE':
self._Shadow = True
else:
self._Shadow = False
@@ -527,79 +527,79 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve CUSTOM_MAKEFILE
def _GetMakefile(self):
- if self._CustomMakefile == None:
- if self._Header_ == None:
+ if self._CustomMakefile is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._CustomMakefile == None:
+ if self._CustomMakefile is None:
self._CustomMakefile = {}
return self._CustomMakefile
## Retrieve EFI_SPECIFICATION_VERSION
def _GetSpec(self):
- if self._Specification == None:
- if self._Header_ == None:
+ if self._Specification is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._Specification == None:
+ if self._Specification is None:
self._Specification = {}
return self._Specification
## Retrieve LIBRARY_CLASS
def _GetLibraryClass(self):
- if self._LibraryClass == None:
- if self._Header_ == None:
+ if self._LibraryClass is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._LibraryClass == None:
+ if self._LibraryClass is None:
self._LibraryClass = []
return self._LibraryClass
## Retrieve ENTRY_POINT
def _GetEntryPoint(self):
- if self._ModuleEntryPointList == None:
- if self._Header_ == None:
+ if self._ModuleEntryPointList is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._ModuleEntryPointList == None:
+ if self._ModuleEntryPointList is None:
self._ModuleEntryPointList = []
return self._ModuleEntryPointList
## Retrieve UNLOAD_IMAGE
def _GetUnloadImage(self):
- if self._ModuleUnloadImageList == None:
- if self._Header_ == None:
+ if self._ModuleUnloadImageList is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._ModuleUnloadImageList == None:
+ if self._ModuleUnloadImageList is None:
self._ModuleUnloadImageList = []
return self._ModuleUnloadImageList
## Retrieve CONSTRUCTOR
def _GetConstructor(self):
- if self._ConstructorList == None:
- if self._Header_ == None:
+ if self._ConstructorList is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._ConstructorList == None:
+ if self._ConstructorList is None:
self._ConstructorList = []
return self._ConstructorList
## Retrieve DESTRUCTOR
def _GetDestructor(self):
- if self._DestructorList == None:
- if self._Header_ == None:
+ if self._DestructorList is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._DestructorList == None:
+ if self._DestructorList is None:
self._DestructorList = []
return self._DestructorList
## Retrieve definies other than above ones
def _GetDefines(self):
- if self._Defs == None:
- if self._Header_ == None:
+ if self._Defs is None:
+ if self._Header_ is None:
self._GetHeaderInfo()
- if self._Defs == None:
+ if self._Defs is None:
self._Defs = sdict()
return self._Defs
## Retrieve binary files
def _GetBinaries(self):
- if self._Binaries == None:
+ if self._Binaries is None:
self._Binaries = []
RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]
Macros = self._Macros
@@ -646,7 +646,7 @@ class InfBuildData(ModuleBuildClassObject):
self._Sources = []
return self._Sources
- if self._Sources == None:
+ if self._Sources is None:
self._Sources = []
RecordList = self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, self._Platform]
Macros = self._Macros
@@ -687,7 +687,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve library classes employed by this module
def _GetLibraryClassUses(self):
- if self._LibraryClasses == None:
+ if self._LibraryClasses is None:
self._LibraryClasses = sdict()
RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, self._Platform]
for Record in RecordList:
@@ -700,7 +700,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve library names (for Edk.x style of modules)
def _GetLibraryNames(self):
- if self._Libraries == None:
+ if self._Libraries is None:
self._Libraries = []
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch, self._Platform]
for Record in RecordList:
@@ -716,14 +716,14 @@ class InfBuildData(ModuleBuildClassObject):
return self._ProtocolComments
## Retrieve protocols consumed/produced by this module
def _GetProtocols(self):
- if self._Protocols == None:
+ if self._Protocols is None:
self._Protocols = sdict()
self._ProtocolComments = sdict()
RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]
for Record in RecordList:
CName = Record[0]
Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
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,
@@ -741,14 +741,14 @@ class InfBuildData(ModuleBuildClassObject):
return self._PpiComments
## Retrieve PPIs consumed/produced by this module
def _GetPpis(self):
- if self._Ppis == None:
+ if self._Ppis is None:
self._Ppis = sdict()
self._PpiComments = sdict()
RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]
for Record in RecordList:
CName = Record[0]
Value = PpiValue(CName, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
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,
@@ -766,14 +766,14 @@ class InfBuildData(ModuleBuildClassObject):
return self._GuidComments
## Retrieve GUIDs consumed/produced by this module
def _GetGuids(self):
- if self._Guids == None:
+ if self._Guids is None:
self._Guids = sdict()
self._GuidComments = sdict()
RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]
for Record in RecordList:
CName = Record[0]
Value = GuidValue(CName, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
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,
@@ -788,7 +788,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve include paths necessary for this module (for Edk.x style of modules)
def _GetIncludes(self):
- if self._Includes == None:
+ if self._Includes is None:
self._Includes = []
if self._SourceOverridePath:
self._Includes.append(self._SourceOverridePath)
@@ -845,7 +845,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve packages this module depends on
def _GetPackages(self):
- if self._Packages == None:
+ if self._Packages is None:
self._Packages = []
RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]
Macros = self._Macros
@@ -868,7 +868,7 @@ class InfBuildData(ModuleBuildClassObject):
return self._PcdComments
## Retrieve PCDs used in this module
def _GetPcds(self):
- if self._Pcds == None:
+ if self._Pcds is None:
self._Pcds = sdict()
self._PcdComments = sdict()
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
@@ -880,7 +880,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve build options specific to this module
def _GetBuildOptions(self):
- if self._BuildOptions == None:
+ if self._BuildOptions is None:
self._BuildOptions = sdict()
RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, self._Platform]
for Record in RecordList:
@@ -897,13 +897,13 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve dependency expression
def _GetDepex(self):
- if self._Depex == None:
+ if self._Depex is None:
self._Depex = tdict(False, 2)
RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
# If the module has only Binaries and no Sources, then ignore [Depex]
- if self.Sources == None or self.Sources == []:
- if self.Binaries != None and self.Binaries != []:
+ if self.Sources is None or self.Sources == []:
+ if self.Binaries is not None and self.Binaries != []:
return self._Depex
# PEIM and DXE drivers must have a valid [Depex] section
@@ -935,18 +935,18 @@ class InfBuildData(ModuleBuildClassObject):
elif Token.endswith(".inf"): # module file name
ModuleFile = os.path.normpath(Token)
Module = self.BuildDatabase[ModuleFile]
- if Module == None:
+ if Module is None:
EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Module is not found in active platform",
ExtraData=Token, File=self.MetaFile, Line=Record[-1])
DepexList.append(Module.Guid)
else:
# get the GUID value now
Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
Value = PpiValue(Token, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
Value = GuidValue(Token, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
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,
@@ -958,7 +958,7 @@ class InfBuildData(ModuleBuildClassObject):
## Retrieve depedency expression
def _GetDepexExpression(self):
- if self._DepexExpression == None:
+ if self._DepexExpression is None:
self._DepexExpression = tdict(False, 2)
RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
DepexExpression = sdict()
@@ -989,7 +989,7 @@ class InfBuildData(ModuleBuildClassObject):
# get the guid value
if TokenSpaceGuid not in self.Guids:
Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path)
- if Value == None:
+ if Value is None:
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,
@@ -1006,7 +1006,7 @@ class InfBuildData(ModuleBuildClassObject):
for PcdCName, TokenSpaceGuid in PcdList:
PcdRealName = PcdCName
Setting, LineNo = PcdDict[self._Arch, self.Platform, PcdCName, TokenSpaceGuid]
- if Setting == None:
+ if Setting is None:
continue
ValueList = AnalyzePcdData(Setting)
DefaultValue = ValueList[0]
@@ -1095,7 +1095,7 @@ class InfBuildData(ModuleBuildClassObject):
#
# Check whether the token value exist or not.
#
- if Pcd.TokenValue == None or Pcd.TokenValue == "":
+ if Pcd.TokenValue is None or Pcd.TokenValue == "":
EdkLogger.error(
'build',
FORMAT_INVALID,
@@ -1108,7 +1108,7 @@ class InfBuildData(ModuleBuildClassObject):
#
ReIsValidPcdTokenValue = re.compile(r"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re.DOTALL)
if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):
- if ReIsValidPcdTokenValue.match(Pcd.TokenValue) == None:
+ if ReIsValidPcdTokenValue.match(Pcd.TokenValue) is None:
EdkLogger.error(
'build',
FORMAT_INVALID,
diff --git a/BaseTools/Source/Python/Workspace/MetaDataTable.py b/BaseTools/Source/Python/Workspace/MetaDataTable.py
index ee4ba6869f..0cfec90232 100644
--- a/BaseTools/Source/Python/Workspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaDataTable.py
@@ -113,7 +113,7 @@ class Table(object):
SqlCommand = """select max(ID) from %s""" % self.Table
Record = self.Cur.execute(SqlCommand).fetchall()
Id = Record[0][0]
- if Id == None:
+ if Id is None:
Id = self.IdBase
return Id
@@ -311,7 +311,7 @@ class TableDataModel(Table):
def InitTable(self):
EdkLogger.verbose("\nInitialize table DataModel started ...")
Count = self.GetCount()
- if Count != None and Count != 0:
+ if Count is not None and Count != 0:
return
for Item in DataClass.MODEL_LIST:
CrossIndex = Item[1]
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 2eb4c75e46..f4c1868483 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -241,7 +241,7 @@ class MetaFileParser(object):
self.Start()
# No specific ARCH or Platform given, use raw data
- if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):
+ if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] is None):
return self._FilterRecordList(self._RawTable.Query(*DataInfo), self._Arch)
# Do post-process if necessary
@@ -620,7 +620,7 @@ class InfParser(MetaFileParser):
self._ValueList = ['', '', '']
# parse current line, result will be put in self._ValueList
self._SectionParser[self._SectionType](self)
- if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
self._ItemType = -1
Comments = []
continue
@@ -952,7 +952,7 @@ class DscParser(MetaFileParser):
self._ValueList = ['', '', '']
self._SectionParser[SectionType](self)
- if self._ValueList == None:
+ if self._ValueList is None:
continue
#
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
@@ -1361,7 +1361,7 @@ class DscParser(MetaFileParser):
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
Line=self._LineIndex + 1)
- if self._ValueList == None:
+ if self._ValueList is None:
continue
NewOwner = self._IdMapping.get(Owner, -1)
@@ -1740,7 +1740,7 @@ class DecParser(MetaFileParser):
# section content
self._ValueList = ['', '', '']
self._SectionParser[self._SectionType[0]](self)
- if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
self._ItemType = -1
self._Comments = []
continue
diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index d8549c9d66..be3fb3d688 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -140,11 +140,11 @@ class ModuleTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>=0" % Model
ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
- if Arch != None and Arch != 'COMMON':
+ if Arch is not None and Arch != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
- if Platform != None and Platform != 'COMMON':
+ if Platform is not None and Platform != 'COMMON':
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Platform
- if BelongsToItem != None:
+ if BelongsToItem is not None:
ConditionString += " AND BelongsToItem=%s" % BelongsToItem
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
@@ -221,7 +221,7 @@ class PackageTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>=0" % Model
ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
- if Arch != None and Arch != 'COMMON':
+ if Arch is not None and Arch != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
@@ -341,9 +341,9 @@ class PlatformTable(MetaFileTable):
ConditionString = "Model=%s AND Enabled>0" % Model
ValueString = "Value1,Value2,Value3,Scope1,Scope2,Scope3,ID,StartLine"
- if Scope1 != None and Scope1 != 'COMMON':
+ if Scope1 is not None and Scope1 != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1
- if Scope2 != None and Scope2 != 'COMMON':
+ if Scope2 is not None and Scope2 != 'COMMON':
# Cover the case that CodeBase is 'COMMON' for BuildOptions section
if '.' in Scope2:
Index = Scope2.index('.')
@@ -352,12 +352,12 @@ class PlatformTable(MetaFileTable):
else:
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2
- if BelongsToItem != None:
+ if BelongsToItem is not None:
ConditionString += " AND BelongsToItem=%s" % BelongsToItem
else:
ConditionString += " AND BelongsToItem<0"
- if FromItem != None:
+ if FromItem is not None:
ConditionString += " AND FromItem=%s" % FromItem
SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index c760e57b8f..abe34cf9a0 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -118,16 +118,16 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
LibraryPath = PlatformModule.LibraryClasses[LibraryClassName]
else:
LibraryPath = Platform.LibraryClasses[LibraryClassName, ModuleType]
- if LibraryPath == None or LibraryPath == "":
+ if LibraryPath is None or LibraryPath == "":
LibraryPath = M.LibraryClasses[LibraryClassName]
- if LibraryPath == None or LibraryPath == "":
+ if LibraryPath is None or LibraryPath == "":
return []
LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
# for those forced library instance (NULL library), add a fake library class
if LibraryClassName.startswith("NULL"):
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
- elif LibraryModule.LibraryClass == None \
+ elif LibraryModule.LibraryClass is None \
or len(LibraryModule.LibraryClass) == 0 \
or (ModuleType != 'USER_DEFINED'
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
@@ -139,7 +139,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
else:
LibraryModule = LibraryInstance[LibraryClassName]
- if LibraryModule == None:
+ if LibraryModule is None:
continue
if LibraryModule.ConstructorList != [] and LibraryModule not in Constructor:
@@ -239,12 +239,12 @@ def _ResolveLibraryReference(Module, Platform):
M = LibraryConsumerList.pop()
for LibraryName in M.Libraries:
Library = Platform.LibraryClasses[LibraryName, ':dummy:']
- if Library == None:
+ if Library is None:
for Key in Platform.LibraryClasses.data.keys():
if LibraryName.upper() == Key.upper():
Library = Platform.LibraryClasses[Key, ':dummy:']
break
- if Library == None:
+ if Library is None:
continue
if Library not in LibraryList:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index a3407d113e..2b888c0610 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -214,7 +214,7 @@ class WorkspaceDatabase(object):
else:
curPath = os.path.dirname(__file__) # curPath is the path of WorkspaceDatabase.py
rootPath = os.path.split(curPath)[0] # rootPath is root path of python source, such as /BaseTools/Source/Python
- if rootPath == "" or rootPath == None:
+ if rootPath == "" or rootPath is None:
EdkLogger.verbose("\nFail to find the root path of build.exe or python sources, so can not \
determine whether database file is out of date!\n")
@@ -308,13 +308,13 @@ determine whether database file is out of date!\n")
Platform = self.BuildObject[PathClass(PlatformFile), 'COMMON']
except:
Platform = None
- if Platform != None:
+ if Platform is not None:
PlatformList.append(Platform)
return PlatformList
def _MapPlatform(self, Dscfile):
Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
- if Platform == None:
+ if Platform is None:
EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
return Platform