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>
This commit is contained in:
committed by
Yonghong Zhu
parent
05a32984ab
commit
4231a8193e
@ -58,7 +58,7 @@ class Page(BaseDoxygeItem):
|
||||
return subpage
|
||||
|
||||
def AddPages(self, pageArray):
|
||||
if pageArray == None:
|
||||
if pageArray is None:
|
||||
return
|
||||
for page in pageArray:
|
||||
self.AddPage(page)
|
||||
@ -370,7 +370,7 @@ class DoxygenConfigFile:
|
||||
self.mWarningFile = str.replace('\\', '/')
|
||||
|
||||
def FileExists(self, path):
|
||||
if path == None:
|
||||
if path is None:
|
||||
return False
|
||||
if len(path) == 0:
|
||||
return False
|
||||
@ -382,7 +382,7 @@ class DoxygenConfigFile:
|
||||
return False
|
||||
|
||||
def AddFile(self, path):
|
||||
if path == None:
|
||||
if path is None:
|
||||
return
|
||||
|
||||
if len(path) == 0:
|
||||
|
@ -553,7 +553,7 @@ class EfiFvMapFile(object):
|
||||
if line[0] != ' ':
|
||||
# new entry
|
||||
ret = rMapEntry.match(line)
|
||||
if ret != None:
|
||||
if ret is not None:
|
||||
name = ret.groups()[0]
|
||||
baseaddr = int(ret.groups()[1], 16)
|
||||
entry = int(ret.groups()[2], 16)
|
||||
|
@ -34,7 +34,7 @@ class BaseINIFile(object):
|
||||
if key not in cls._objs.keys():
|
||||
cls._objs[key] = object.__new__(cls, *args, **kwargs)
|
||||
|
||||
if parent != None:
|
||||
if parent is not None:
|
||||
cls._objs[key].AddParent(parent)
|
||||
|
||||
return cls._objs[key]
|
||||
@ -47,7 +47,7 @@ class BaseINIFile(object):
|
||||
self._isModify = True
|
||||
|
||||
def AddParent(self, parent):
|
||||
if parent == None: return
|
||||
if parent is None: return
|
||||
if not hasattr(self, "_parents"):
|
||||
self._parents = []
|
||||
|
||||
@ -122,7 +122,7 @@ class BaseINIFile(object):
|
||||
continue
|
||||
|
||||
m = section_re.match(templine)
|
||||
if m!= None: # found a section
|
||||
if mis not None: # found a section
|
||||
inGlobal = False
|
||||
# Finish the latest section first
|
||||
if len(sObjs) != 0:
|
||||
@ -165,7 +165,7 @@ class BaseINIFile(object):
|
||||
def Destroy(self, parent):
|
||||
|
||||
# check referenced parent
|
||||
if parent != None:
|
||||
if parent is not None:
|
||||
assert parent in self._parents, "when destory ini object, can not found parent reference!"
|
||||
self._parents.remove(parent)
|
||||
|
||||
@ -307,7 +307,7 @@ class BaseINISection(object):
|
||||
visit += 1
|
||||
continue
|
||||
line = line.split('#')[0].strip()
|
||||
if iniObj != None:
|
||||
if iniObj is not None:
|
||||
if line.endswith('}'):
|
||||
iniObj._end = visit - self._start
|
||||
if not iniObj.Parse():
|
||||
|
@ -35,14 +35,14 @@ def WarnMsg(mess, fName=None, fNo=None):
|
||||
def NormalMessage(type, mess, fName=None, fNo=None):
|
||||
strMsg = type
|
||||
|
||||
if fName != None:
|
||||
if fName is not None:
|
||||
strMsg += ' %s' % fName.replace('/', '\\')
|
||||
if fNo != None:
|
||||
if fNo is not None:
|
||||
strMsg += '(%d):' % fNo
|
||||
else:
|
||||
strMsg += ' :'
|
||||
|
||||
if fName == None and fNo == None:
|
||||
if fName is None and fNo is None:
|
||||
strMsg += ' '
|
||||
strMsg += mess
|
||||
|
||||
|
@ -74,7 +74,7 @@ class SurfaceObject(object):
|
||||
|
||||
def Load(self, relativePath):
|
||||
# if has been loaded, directly return
|
||||
if self._fileObj != None: return True
|
||||
if self._fileObj is not None: return True
|
||||
|
||||
relativePath = os.path.normpath(relativePath)
|
||||
fullPath = os.path.join(self._workspace, relativePath)
|
||||
@ -160,7 +160,7 @@ class Platform(SurfaceObject):
|
||||
return dsc.DSCFile
|
||||
|
||||
def GetModuleCount(self):
|
||||
if self.GetFileObj() == None:
|
||||
if self.GetFileObj() is None:
|
||||
ErrorMsg("Fail to get module count because DSC file has not been load!")
|
||||
|
||||
return len(self.GetFileObj().GetComponents())
|
||||
@ -171,7 +171,7 @@ class Platform(SurfaceObject):
|
||||
def LoadModules(self, precallback=None, postcallback=None):
|
||||
for obj in self.GetFileObj().GetComponents():
|
||||
mFilename = obj.GetFilename()
|
||||
if precallback != None:
|
||||
if precallback is not None:
|
||||
precallback(self, mFilename)
|
||||
arch = obj.GetArch()
|
||||
if arch.lower() == 'common':
|
||||
@ -182,7 +182,7 @@ class Platform(SurfaceObject):
|
||||
module = Module(self, self.GetWorkspace())
|
||||
if module.Load(mFilename, arch, obj.GetOveridePcds(), obj.GetOverideLibs()):
|
||||
self._modules.append(module)
|
||||
if postcallback != None:
|
||||
if postcallback is not None:
|
||||
postcallback(self, module)
|
||||
else:
|
||||
del module
|
||||
@ -222,7 +222,7 @@ class Platform(SurfaceObject):
|
||||
for obj in objs:
|
||||
if obj.GetPcdName().lower() == name.lower():
|
||||
arr.append(obj)
|
||||
if arch != None:
|
||||
if arch is not None:
|
||||
arr = self.FilterObjsByArch(arr, arch)
|
||||
return arr
|
||||
|
||||
@ -292,7 +292,7 @@ class Platform(SurfaceObject):
|
||||
newSect = newDsc.AddNewSection(oldSect.GetName())
|
||||
for oldComObj in oldSect.GetObjects():
|
||||
module = self.GetModuleObject(oldComObj.GetFilename(), oldSect.GetArch())
|
||||
if module == None: continue
|
||||
if module is None: continue
|
||||
|
||||
newComObj = dsc.DSCComponentObject(newSect)
|
||||
newComObj.SetFilename(oldComObj.GetFilename())
|
||||
@ -300,7 +300,7 @@ class Platform(SurfaceObject):
|
||||
# add all library instance for override section
|
||||
libdict = module.GetLibraries()
|
||||
for libclass in libdict.keys():
|
||||
if libdict[libclass] != None:
|
||||
if libdict[libclass] is not None:
|
||||
newComObj.AddOverideLib(libclass, libdict[libclass].GetRelativeFilename().replace('\\', '/'))
|
||||
|
||||
# add all pcds for override section
|
||||
@ -338,7 +338,7 @@ class Module(SurfaceObject):
|
||||
|
||||
def Destroy(self):
|
||||
for lib in self._libs.values():
|
||||
if lib != None:
|
||||
if lib is not None:
|
||||
lib.Destroy()
|
||||
self._libs.clear()
|
||||
|
||||
@ -351,12 +351,12 @@ class Module(SurfaceObject):
|
||||
del self._ppis[:]
|
||||
|
||||
for protocol in self._protocols:
|
||||
if protocol != None:
|
||||
if protocol is not None:
|
||||
protocol.DeRef(self)
|
||||
del self._protocols[:]
|
||||
|
||||
for guid in self._guids:
|
||||
if guid != None:
|
||||
if guid is not None:
|
||||
guid.DeRef(self)
|
||||
del self._guids[:]
|
||||
|
||||
@ -375,9 +375,9 @@ class Module(SurfaceObject):
|
||||
return False
|
||||
|
||||
self._arch = arch
|
||||
if overidePcds != None:
|
||||
if overidePcds is not None:
|
||||
self._overideLibs = overideLibs
|
||||
if overideLibs != None:
|
||||
if overideLibs is not None:
|
||||
self._overidePcds = overidePcds
|
||||
|
||||
self._SearchLibraries()
|
||||
@ -403,7 +403,7 @@ class Module(SurfaceObject):
|
||||
def GetPcds(self):
|
||||
pcds = self._pcds.copy()
|
||||
for lib in self._libs.values():
|
||||
if lib == None: continue
|
||||
if lib is None: continue
|
||||
for name in lib._pcds.keys():
|
||||
pcds[name] = lib._pcds[name]
|
||||
return pcds
|
||||
@ -412,7 +412,7 @@ class Module(SurfaceObject):
|
||||
ppis = []
|
||||
ppis += self._ppis
|
||||
for lib in self._libs.values():
|
||||
if lib == None: continue
|
||||
if lib is None: continue
|
||||
ppis += lib._ppis
|
||||
return ppis
|
||||
|
||||
@ -420,7 +420,7 @@ class Module(SurfaceObject):
|
||||
pros = []
|
||||
pros = self._protocols
|
||||
for lib in self._libs.values():
|
||||
if lib == None: continue
|
||||
if lib is None: continue
|
||||
pros += lib._protocols
|
||||
return pros
|
||||
|
||||
@ -428,7 +428,7 @@ class Module(SurfaceObject):
|
||||
guids = []
|
||||
guids += self._guids
|
||||
for lib in self._libs.values():
|
||||
if lib == None: continue
|
||||
if lib is None: continue
|
||||
guids += lib._guids
|
||||
return guids
|
||||
|
||||
@ -436,12 +436,12 @@ class Module(SurfaceObject):
|
||||
deps = []
|
||||
deps += self._depexs
|
||||
for lib in self._libs.values():
|
||||
if lib == None: continue
|
||||
if lib is None: continue
|
||||
deps += lib._depexs
|
||||
return deps
|
||||
|
||||
def IsLibrary(self):
|
||||
return self.GetFileObj().GetDefine("LIBRARY_CLASS") != None
|
||||
return self.GetFileObj().GetDefine("LIBRARY_CLASS") is not None
|
||||
|
||||
def GetLibraryInstance(self, classname, arch, type):
|
||||
if classname not in self._libs.keys():
|
||||
@ -454,7 +454,7 @@ class Module(SurfaceObject):
|
||||
parent = self.GetParent()
|
||||
if issubclass(parent.__class__, Platform):
|
||||
path = parent.GetLibraryPath(classname, arch, type)
|
||||
if path == None:
|
||||
if path is None:
|
||||
ErrorMsg('Fail to get library instance for %s' % classname, self.GetFilename())
|
||||
return None
|
||||
self._libs[classname] = Library(self, self.GetWorkspace())
|
||||
@ -477,7 +477,7 @@ class Module(SurfaceObject):
|
||||
continue
|
||||
classname = obj.GetClass()
|
||||
instance = self.GetLibraryInstance(classname, arch, type)
|
||||
if not self.IsLibrary() and instance != None:
|
||||
if not self.IsLibrary() and instance is not None:
|
||||
instance._isInherit = False
|
||||
|
||||
if classname not in self._libs.keys():
|
||||
@ -490,7 +490,7 @@ class Module(SurfaceObject):
|
||||
pros = []
|
||||
deps = []
|
||||
guids = []
|
||||
if self.GetFileObj() != None:
|
||||
if self.GetFileObj() is not None:
|
||||
pcds = self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('pcd'),
|
||||
self.GetArch())
|
||||
for pcd in pcds:
|
||||
@ -534,31 +534,31 @@ class Module(SurfaceObject):
|
||||
objs = self.GetFileObj().GetSectionObjectsByName('packages')
|
||||
for obj in objs:
|
||||
package = self.GetPlatform().GetPackage(obj.GetPath())
|
||||
if package != None:
|
||||
if package is not None:
|
||||
self._packages.append(package)
|
||||
|
||||
def GetPackages(self):
|
||||
return self._packages
|
||||
|
||||
def GetPcdObjects(self):
|
||||
if self.GetFileObj() == None:
|
||||
if self.GetFileObj() is None:
|
||||
return []
|
||||
|
||||
return self.GetFileObj().GetSectionObjectsByName('pcd')
|
||||
|
||||
def GetLibraryClassHeaderFilePath(self):
|
||||
lcname = self.GetFileObj().GetProduceLibraryClass()
|
||||
if lcname == None: return None
|
||||
if lcname is None: return None
|
||||
|
||||
pkgs = self.GetPackages()
|
||||
for package in pkgs:
|
||||
path = package.GetLibraryClassHeaderPathByName(lcname)
|
||||
if path != None:
|
||||
if path is not None:
|
||||
return os.path.realpath(os.path.join(package.GetFileObj().GetPackageRootPath(), path))
|
||||
return None
|
||||
|
||||
def Reload(self, force=False, callback=None):
|
||||
if callback != None:
|
||||
if callback is not None:
|
||||
callback(self, "Starting reload...")
|
||||
|
||||
ret = SurfaceObject.Reload(self, force)
|
||||
@ -568,7 +568,7 @@ class Module(SurfaceObject):
|
||||
return True
|
||||
|
||||
for lib in self._libs.values():
|
||||
if lib != None:
|
||||
if lib is not None:
|
||||
lib.Destroy()
|
||||
self._libs.clear()
|
||||
|
||||
@ -591,13 +591,13 @@ class Module(SurfaceObject):
|
||||
del self._packages[:]
|
||||
del self._depexs[:]
|
||||
|
||||
if callback != None:
|
||||
if callback is not None:
|
||||
callback(self, "Searching libraries...")
|
||||
self._SearchLibraries()
|
||||
if callback != None:
|
||||
if callback is not None:
|
||||
callback(self, "Searching packages...")
|
||||
self._SearchPackage()
|
||||
if callback != None:
|
||||
if callback is not None:
|
||||
callback(self, "Searching surface items...")
|
||||
self._SearchSurfaceItems()
|
||||
|
||||
@ -665,16 +665,16 @@ class Package(SurfaceObject):
|
||||
|
||||
def Destroy(self):
|
||||
for pcd in self._pcds.values():
|
||||
if pcd != None:
|
||||
if pcd is not None:
|
||||
pcd.Destroy()
|
||||
for guid in self._guids.values():
|
||||
if guid != None:
|
||||
if guid is not None:
|
||||
guid.Destroy()
|
||||
for protocol in self._protocols.values():
|
||||
if protocol != None:
|
||||
if protocol is not None:
|
||||
protocol.Destroy()
|
||||
for ppi in self._ppis.values():
|
||||
if ppi != None:
|
||||
if ppi is not None:
|
||||
ppi.Destroy()
|
||||
self._pcds.clear()
|
||||
self._guids.clear()
|
||||
@ -689,7 +689,7 @@ class Package(SurfaceObject):
|
||||
pcds = self.GetFileObj().GetSectionObjectsByName('pcds')
|
||||
for pcd in pcds:
|
||||
if pcd.GetPcdName() in self._pcds.keys():
|
||||
if self._pcds[pcd.GetPcdName()] != None:
|
||||
if self._pcds[pcd.GetPcdName()] is not None:
|
||||
self._pcds[pcd.GetPcdName()].AddDecObj(pcd)
|
||||
else:
|
||||
self._pcds[pcd.GetPcdName()] = PcdItem(pcd.GetPcdName(), self, pcd)
|
||||
@ -726,7 +726,7 @@ class Package(SurfaceObject):
|
||||
def GetPcdDefineObjs(self, name=None):
|
||||
arr = []
|
||||
objs = self.GetFileObj().GetSectionObjectsByName('pcds')
|
||||
if name == None: return objs
|
||||
if name is None: return objs
|
||||
|
||||
for obj in objs:
|
||||
if obj.GetPcdName().lower() == name.lower():
|
||||
@ -772,7 +772,7 @@ class ModulePcd(object):
|
||||
|
||||
def __init__(self, parent, name, infObj, pcdItem):
|
||||
assert issubclass(parent.__class__, Module), "Module's PCD's parent must be module!"
|
||||
assert pcdItem != None, 'Pcd %s does not in some package!' % name
|
||||
assert pcdItem is not None, 'Pcd %s does not in some package!' % name
|
||||
|
||||
self._name = name
|
||||
self._parent = parent
|
||||
|
@ -77,7 +77,7 @@ class DECSection(ini.BaseINISection):
|
||||
return arr[1]
|
||||
|
||||
def IsArchMatch(self, arch):
|
||||
if arch == None or self.GetArch() == 'common':
|
||||
if arch is None or self.GetArch() == 'common':
|
||||
return True
|
||||
|
||||
if self.GetArch().lower() != arch.lower():
|
||||
|
@ -69,7 +69,7 @@ class DoxygenAction:
|
||||
self._chmCallback = None
|
||||
|
||||
def Log(self, message, level='info'):
|
||||
if self._log != None:
|
||||
if self._log is not None:
|
||||
self._log(message, level)
|
||||
|
||||
def IsVerbose(self):
|
||||
@ -94,7 +94,7 @@ class DoxygenAction:
|
||||
|
||||
self.Log(" >>>>>> Generate doxygen index page file...Zzz...\n")
|
||||
indexPagePath = self.GenerateIndexPage()
|
||||
if indexPagePath == None:
|
||||
if indexPagePath is None:
|
||||
self.Log("Fail to generate index page!\n", 'error')
|
||||
return False
|
||||
else:
|
||||
@ -109,7 +109,7 @@ class DoxygenAction:
|
||||
self.Log(" <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)
|
||||
|
||||
# launch doxygen tool to generate document
|
||||
if self._doxygenCallback != None:
|
||||
if self._doxygenCallback is not None:
|
||||
self.Log(" >>>>>> Start doxygen process...Zzz...\n")
|
||||
if not self._doxygenCallback(self._doxPath, configFilePath):
|
||||
return False
|
||||
@ -166,9 +166,9 @@ class PackageDocumentAction(DoxygenAction):
|
||||
self._configFile.AddPreDefined('MDE_CPU_ARM')
|
||||
|
||||
namestr = self._pObj.GetName()
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
namestr += '[%s]' % self._arch
|
||||
if self._tooltag != None:
|
||||
if self._tooltag is not None:
|
||||
namestr += '[%s]' % self._tooltag
|
||||
self._configFile.SetProjectName(namestr)
|
||||
self._configFile.SetStripPath(self._pObj.GetWorkspace())
|
||||
@ -314,7 +314,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
classPage = doxygen.Page(obj.GetClassName(),
|
||||
"lc_%s" % obj.GetClassName())
|
||||
@ -399,7 +399,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())
|
||||
filePath = mo.groups()[0]
|
||||
|
||||
if filePath == None or len(filePath) == 0:
|
||||
if filePath is None or len(filePath) == 0:
|
||||
continue
|
||||
|
||||
# find header file in module's path firstly.
|
||||
@ -417,7 +417,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(incPath):
|
||||
fullPath = incPath
|
||||
break
|
||||
if infObj != None:
|
||||
if infObj is not None:
|
||||
pkgInfObjs = infObj.GetSectionObjectsByName('packages')
|
||||
for obj in pkgInfObjs:
|
||||
decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))
|
||||
@ -433,10 +433,10 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(os.path.join(incPath, filePath)):
|
||||
fullPath = os.path.join(os.path.join(incPath, filePath))
|
||||
break
|
||||
if fullPath != None:
|
||||
if fullPath is not None:
|
||||
break
|
||||
|
||||
if fullPath == None and self.IsVerbose():
|
||||
if fullPath is None and self.IsVerbose():
|
||||
self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')
|
||||
return
|
||||
else:
|
||||
@ -477,7 +477,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())
|
||||
pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])
|
||||
typeRoot = typeRootPageDict[obj.GetPcdType()]
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
|
||||
'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
|
||||
pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
|
||||
@ -573,7 +573,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('GUID', 'guid_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -626,7 +626,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PPI', 'ppi_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -680,7 +680,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -773,7 +773,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if not infObj.Parse():
|
||||
self.Log('Fail to load INF file %s' % inf)
|
||||
continue
|
||||
if infObj.GetProduceLibraryClass() != None:
|
||||
if infObj.GetProduceLibraryClass() is not None:
|
||||
libObjs.append(infObj)
|
||||
else:
|
||||
modObjs.append(infObj)
|
||||
@ -951,7 +951,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),
|
||||
workspace,
|
||||
refDecObjs)
|
||||
if retarr != None:
|
||||
if retarr is not None:
|
||||
pkgname, hPath = retarr
|
||||
else:
|
||||
self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')
|
||||
|
@ -66,7 +66,7 @@ class DoxygenAction:
|
||||
self._chmCallback = None
|
||||
|
||||
def Log(self, message, level='info'):
|
||||
if self._log != None:
|
||||
if self._log is not None:
|
||||
self._log(message, level)
|
||||
|
||||
def IsVerbose(self):
|
||||
@ -91,7 +91,7 @@ class DoxygenAction:
|
||||
|
||||
self.Log(" >>>>>> Generate doxygen index page file...Zzz...\n")
|
||||
indexPagePath = self.GenerateIndexPage()
|
||||
if indexPagePath == None:
|
||||
if indexPagePath is None:
|
||||
self.Log("Fail to generate index page!\n", 'error')
|
||||
return False
|
||||
else:
|
||||
@ -106,7 +106,7 @@ class DoxygenAction:
|
||||
self.Log(" <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)
|
||||
|
||||
# launch doxygen tool to generate document
|
||||
if self._doxygenCallback != None:
|
||||
if self._doxygenCallback is not None:
|
||||
self.Log(" >>>>>> Start doxygen process...Zzz...\n")
|
||||
if not self._doxygenCallback(self._doxPath, configFilePath):
|
||||
return False
|
||||
@ -167,9 +167,9 @@ class PackageDocumentAction(DoxygenAction):
|
||||
self._configFile.AddPreDefined(macro)
|
||||
|
||||
namestr = self._pObj.GetName()
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
namestr += '[%s]' % self._arch
|
||||
if self._tooltag != None:
|
||||
if self._tooltag is not None:
|
||||
namestr += '[%s]' % self._tooltag
|
||||
self._configFile.SetProjectName(namestr)
|
||||
self._configFile.SetStripPath(self._pObj.GetWorkspace())
|
||||
@ -315,7 +315,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
classPage = doxygen.Page(obj.GetClassName(),
|
||||
"lc_%s" % obj.GetClassName())
|
||||
@ -401,7 +401,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())
|
||||
filePath = mo.groups()[0]
|
||||
|
||||
if filePath == None or len(filePath) == 0:
|
||||
if filePath is None or len(filePath) == 0:
|
||||
continue
|
||||
|
||||
# find header file in module's path firstly.
|
||||
@ -419,7 +419,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(incPath):
|
||||
fullPath = incPath
|
||||
break
|
||||
if infObj != None:
|
||||
if infObj is not None:
|
||||
pkgInfObjs = infObj.GetSectionObjectsByName('packages')
|
||||
for obj in pkgInfObjs:
|
||||
decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))
|
||||
@ -435,10 +435,10 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if os.path.exists(os.path.join(incPath, filePath)):
|
||||
fullPath = os.path.join(os.path.join(incPath, filePath))
|
||||
break
|
||||
if fullPath != None:
|
||||
if fullPath is not None:
|
||||
break
|
||||
|
||||
if fullPath == None and self.IsVerbose():
|
||||
if fullPath is None and self.IsVerbose():
|
||||
self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')
|
||||
return
|
||||
else:
|
||||
@ -479,7 +479,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())
|
||||
pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])
|
||||
typeRoot = typeRootPageDict[obj.GetPcdType()]
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
|
||||
'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
|
||||
pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
|
||||
@ -575,7 +575,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('GUID', 'guid_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -628,7 +628,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PPI', 'ppi_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -682,7 +682,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')
|
||||
objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)
|
||||
if len(objs) == 0: return []
|
||||
if self._arch != None:
|
||||
if self._arch is not None:
|
||||
for obj in objs:
|
||||
pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
|
||||
else:
|
||||
@ -775,7 +775,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
if not infObj.Parse():
|
||||
self.Log('Fail to load INF file %s' % inf)
|
||||
continue
|
||||
if infObj.GetProduceLibraryClass() != None:
|
||||
if infObj.GetProduceLibraryClass() is not None:
|
||||
libObjs.append(infObj)
|
||||
else:
|
||||
modObjs.append(infObj)
|
||||
@ -954,7 +954,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),
|
||||
workspace,
|
||||
refDecObjs)
|
||||
if retarr != None:
|
||||
if retarr is not None:
|
||||
pkgname, hPath = retarr
|
||||
else:
|
||||
self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')
|
||||
|
@ -189,7 +189,7 @@ class DSCComponentObject(DSCSectionObject):
|
||||
lines.append(' <%s>\n' % key)
|
||||
|
||||
for name, value in self._OveridePcds[key]:
|
||||
if value != None:
|
||||
if value is not None:
|
||||
lines.append(' %s|%s\n' % (name, value))
|
||||
else:
|
||||
lines.append(' %s\n' % name)
|
||||
|
@ -23,7 +23,7 @@ class INFFile(ini.BaseINIFile):
|
||||
|
||||
def GetProduceLibraryClass(self):
|
||||
obj = self.GetDefine("LIBRARY_CLASS")
|
||||
if obj == None: return None
|
||||
if obj is None: return None
|
||||
|
||||
return obj.split('|')[0].strip()
|
||||
|
||||
@ -59,7 +59,7 @@ class INFFile(ini.BaseINIFile):
|
||||
if not ini.BaseINIFile.Parse(self):
|
||||
return False
|
||||
classname = self.GetProduceLibraryClass()
|
||||
if classname != None:
|
||||
if classname is not None:
|
||||
libobjdict = INFFile._libobjs
|
||||
if libobjdict.has_key(classname):
|
||||
if self not in libobjdict[classname]:
|
||||
@ -77,7 +77,7 @@ class INFFile(ini.BaseINIFile):
|
||||
|
||||
def Clear(self):
|
||||
classname = self.GetProduceLibraryClass()
|
||||
if classname != None:
|
||||
if classname is not None:
|
||||
libobjdict = INFFile._libobjs
|
||||
libobjdict[classname].remove(self)
|
||||
if len(libobjdict[classname]) == 0:
|
||||
@ -114,7 +114,7 @@ class INFSection(ini.BaseINISection):
|
||||
return arr[1]
|
||||
|
||||
def IsArchMatch(self, arch):
|
||||
if arch == None or self.GetArch() == 'common':
|
||||
if arch is None or self.GetArch() == 'common':
|
||||
return True
|
||||
|
||||
if self.GetArch().lower() != arch.lower():
|
||||
@ -258,9 +258,9 @@ class INFSourceObject(INFSectionObject):
|
||||
del objdict[self.mFilename]
|
||||
|
||||
def IsMatchFamily(self, family):
|
||||
if family == None:
|
||||
if family is None:
|
||||
return True
|
||||
if self.mFamily != None:
|
||||
if self.mFamily is not None:
|
||||
if family.strip().lower() == self.mFamily.lower():
|
||||
return True
|
||||
else:
|
||||
|
Reference in New Issue
Block a user