def FromXml(self, Item, Key): self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) Include = IncludeObject() Include.SetFilePath(self.HeaderFile) HelpTxt = TextObject() HelpTxt.SetString(self.HelpText) Include.SetHelpText(HelpTxt) return Include
def FromXml(self, Item, Key): self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % Key) self.CommonDefines.FromXml(XmlNode(Item, '%s/HeaderFile' % Key), 'HeaderFile') for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) Include = IncludeObject() Include.SetFilePath(self.HeaderFile) Include.SetSupArchList(self.CommonDefines.SupArchList) HelpTxt = TextObject() HelpTxt.SetString(self.HelpText) Include.SetHelpText(HelpTxt) return Include
def GenIncludes(self, ContainerFile): if ContainerFile: pass Logger.Debug(2, "Generate %s ..." % TAB_INCLUDES) IncludesDict = Sdict() IncObj = self.DecParser.GetIncludeSectionObject() for Item in IncObj.GetAllIncludes(): IncludePath = os.path.normpath(Item.File) if platform.system() != 'Windows' and platform.system() != 'Microsoft': IncludePath = IncludePath.replace('\\', '/') if IncludePath in IncludesDict: if Item.GetArchList() == [TAB_ARCH_COMMON] or IncludesDict[IncludePath] == [TAB_ARCH_COMMON]: IncludesDict[IncludePath] = [TAB_ARCH_COMMON] else: IncludesDict[IncludePath] = IncludesDict[IncludePath] + Item.GetArchList() else: IncludesDict[IncludePath] = Item.GetArchList() # # get the standardIncludeFileList(industry), packageIncludeFileList # (others) for PackageObject # PackagePath = os.path.split(self.GetFullPath())[0] IncludePathList = \ sorted([os.path.normpath(Path) + sep for Path in IncludesDict.keys()]) # # get a non-overlap set of include path, IncludePathList should be # sorted, and path should be end with path separator '\' # NonOverLapList = [] for Path1 in IncludePathList: for Path2 in NonOverLapList: if Path1.startswith(Path2): break else: NonOverLapList.append(Path1) # # revert the list so the longest path shown first in list, also need # to remove the extra path separator '\' # as this list is used to search the supported Arch info # for IndexN in range (0, len(IncludePathList)): IncludePathList[IndexN] = os.path.normpath(IncludePathList[IndexN]) IncludePathList.sort() IncludePathList.reverse() # # save the include path list for later usage # self.SetIncludePathList(IncludePathList) StandardIncludeFileList = [] PackageIncludeFileList = [] IncludeFileList = [] for Path in NonOverLapList: FileList = GetFiles(os.path.join(PackagePath, Path), ['CVS', '.svn'], False) IncludeFileList += [os.path.normpath(os.path.join(Path, File)) for File in FileList] for Includefile in IncludeFileList: ExtName = os.path.splitext(Includefile)[1] if ExtName.upper() == '.DEC' and self.CheckMulDec: Logger.Error('MkPkg', UPT_MUL_DEC_ERROR, ST.ERR_MUL_DEC_ERROR%(os.path.dirname(ContainerFile), os.path.basename(ContainerFile), Includefile)) FileCombinePath = os.path.dirname(Includefile) Include = IncludeObject() for Path in IncludePathList: if FileCombinePath.startswith(Path): SupArchList = IncludesDict[Path] break Include.SetFilePath(Includefile) Include.SetSupArchList(SupArchList) if Includefile.find('IndustryStandard') != -1: StandardIncludeFileList.append(Include) else: PackageIncludeFileList.append(Include) self.SetStandardIncludeFileList(StandardIncludeFileList) # # put include path into the PackageIncludeFileList # PackagePathList = [] IncObj = self.DecParser.GetIncludeSectionObject() for Item in IncObj.GetAllIncludes(): IncludePath = Item.File Include = IncludeObject() Include.SetFilePath(IncludePath) Include.SetSupArchList(Item.GetArchList()) PackagePathList.append(Include) self.SetPackageIncludeFileList(PackagePathList + PackageIncludeFileList)