BaseTools/Scripts: Porting PackageDocumentTools code to use Python3

Porting PackageDocumentTools code to Python3
DoxyGen 1.8.6
wxpython 4.0.3

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yunhua Feng 2018-08-28 17:00:24 +08:00 committed by Yonghong Zhu
parent c9486c8c9d
commit 9d7e1e56a7
12 changed files with 62 additions and 67 deletions

View File

@ -1,6 +1,6 @@
Prerequisite Tools: Prerequisite Tools:
1. Install Python 2.7.3 from https://www.python.org/download/releases/2.7.3/ 1. Install Python 3.6.6 from https://www.python.org/downloads/release/python-366/
2. Install wxPython 2.8.12.1 from https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/ 2. Install wxPython 4.0.3 from https://pypi.org/project/wxPython/#files
generally the libraries will be installed at python's subfolder, for example in windows: c:\python27\Lib\site-packages\ generally the libraries will be installed at python's subfolder, for example in windows: c:\python27\Lib\site-packages\
3. Install DoxyGen 1.8.6 from https://sourceforge.net/projects/doxygen/files/rel-1.8.6/ 3. Install DoxyGen 1.8.6 from https://sourceforge.net/projects/doxygen/files/rel-1.8.6/
4. (Windows only) Install Htmlhelp tool from https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx 4. (Windows only) Install Htmlhelp tool from https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx

View File

@ -12,12 +12,11 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
from __future__ import print_function
import os, sys, logging, traceback, subprocess import os, sys, logging, traceback, subprocess
from optparse import OptionParser from optparse import OptionParser
import plugins.EdkPlugins.edk2.model.baseobject as baseobject from .plugins.EdkPlugins.edk2.model import baseobject
import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen from .plugins.EdkPlugins.edk2.model import doxygengen
gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER', gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER',
'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS',
@ -38,7 +37,7 @@ def parseCmdArgs():
help='Specify the absolute path of doxygen tools installation. For example: C:\\Program Files\\doxygen\bin\doxygen.exe') help='Specify the absolute path of doxygen tools installation. For example: C:\\Program Files\\doxygen\bin\doxygen.exe')
parser.add_option('-o', '--output', action='store', dest='OutputPath', parser.add_option('-o', '--output', action='store', dest='OutputPath',
help='Specify the document output path. For example: c:\\docoutput') help='Specify the document output path. For example: c:\\docoutput')
parser.add_option('-a', '--arch', action='store', dest='Arch', choices=gArchMarcoDict.keys(), parser.add_option('-a', '--arch', action='store', dest='Arch', choices=list(gArchMarcoDict.keys()),
help='Specify the architecture used in preprocess package\'s source. For example: -a IA32_MSFT') help='Specify the architecture used in preprocess package\'s source. For example: -a IA32_MSFT')
parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'], parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'],
help='Specify the document mode from : CHM or HTML') help='Specify the document mode from : CHM or HTML')

View File

@ -18,8 +18,8 @@ import os, sys, wx, logging
import wx.stc import wx.stc
import wx.lib.newevent import wx.lib.newevent
import wx.lib.agw.genericmessagedialog as GMD import wx.lib.agw.genericmessagedialog as GMD
import plugins.EdkPlugins.edk2.model.baseobject as baseobject from plugins.EdkPlugins.edk2.model import baseobject
import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen from plugins.EdkPlugins.edk2.model import doxygengen
if hasattr(sys, "frozen"): if hasattr(sys, "frozen"):
appPath = os.path.abspath(os.path.dirname(sys.executable)) appPath = os.path.abspath(os.path.dirname(sys.executable))
@ -42,7 +42,7 @@ class PackageDocApp(wx.App):
frame.Show(True) frame.Show(True)
EVT_APP_CALLBACK( self, self.OnAppCallBack) self.Bind(EVT_APP_CALLBACK, self.OnAppCallBack)
return True return True
def GetLogger(self): def GetLogger(self):
@ -60,13 +60,13 @@ class PackageDocApp(wx.App):
class PackageDocMainFrame(wx.Frame): class PackageDocMainFrame(wx.Frame):
def __init__(self, parent, title): def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(550, 290), style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX ) wx.Frame.__init__(self, parent, -1, title, size=(550, 350), style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX )
panel = wx.Panel(self) panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
subsizer = wx.GridBagSizer(5, 10) subsizer = wx.GridBagSizer(5, 10)
subsizer.AddGrowableCol(1) subsizer.AddGrowableCol(0)
subsizer.Add(wx.StaticText(panel, -1, "Workspace Location : "), (0, 0), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(wx.StaticText(panel, -1, "Workspace Location : "), (0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
self._workspacePathCtrl = wx.ComboBox(panel, -1) self._workspacePathCtrl = wx.ComboBox(panel, -1)
list = self.GetConfigure("WorkspacePath") list = self.GetConfigure("WorkspacePath")
@ -76,9 +76,9 @@ class PackageDocMainFrame(wx.Frame):
self._workspacePathCtrl.SetValue(list[len(list) - 1]) self._workspacePathCtrl.SetValue(list[len(list) - 1])
subsizer.Add(self._workspacePathCtrl, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._workspacePathCtrl, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
self._workspacePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) self._workspacePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
subsizer.Add(self._workspacePathBt, (0, 2), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(self._workspacePathBt, (0, 2), flag=wx.ALIGN_CENTER_VERTICAL)
wx.EVT_BUTTON(self._workspacePathBt, self._workspacePathBt.GetId(), self.OnBrowsePath) self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._workspacePathBt)
subsizer.Add(wx.StaticText(panel, -1, "Package DEC Location : "), (1, 0), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(wx.StaticText(panel, -1, "Package DEC Location : "), (1, 0), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
self._packagePathCtrl = wx.ComboBox(panel, -1) self._packagePathCtrl = wx.ComboBox(panel, -1)
@ -88,9 +88,9 @@ class PackageDocMainFrame(wx.Frame):
self._packagePathCtrl.Append(item) self._packagePathCtrl.Append(item)
self._packagePathCtrl.SetValue(list[len(list) - 1]) self._packagePathCtrl.SetValue(list[len(list) - 1])
subsizer.Add(self._packagePathCtrl, (1, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._packagePathCtrl, (1, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
self._packagePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) self._packagePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
subsizer.Add(self._packagePathBt, (1, 2), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(self._packagePathBt, (1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
wx.EVT_BUTTON(self._packagePathBt, self._packagePathBt.GetId(), self.OnBrowsePath) self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._packagePathBt)
subsizer.Add(wx.StaticText(panel, -1, "Doxygen Tool Location : "), (2, 0), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(wx.StaticText(panel, -1, "Doxygen Tool Location : "), (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
self._doxygenPathCtrl = wx.TextCtrl(panel, -1) self._doxygenPathCtrl = wx.TextCtrl(panel, -1)
@ -103,10 +103,10 @@ class PackageDocMainFrame(wx.Frame):
else: else:
self._doxygenPathCtrl.SetValue('/usr/bin/doxygen') self._doxygenPathCtrl.SetValue('/usr/bin/doxygen')
self._doxygenPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) self._doxygenPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
subsizer.Add(self._doxygenPathCtrl, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._doxygenPathCtrl, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
subsizer.Add(self._doxygenPathBt, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(self._doxygenPathBt, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL)
wx.EVT_BUTTON(self._doxygenPathBt, self._doxygenPathBt.GetId(), self.OnBrowsePath) self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._doxygenPathBt)
subsizer.Add(wx.StaticText(panel, -1, "CHM Tool Location : "), (3, 0), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(wx.StaticText(panel, -1, "CHM Tool Location : "), (3, 0), flag=wx.ALIGN_CENTER_VERTICAL)
self._chmPathCtrl = wx.TextCtrl(panel, -1) self._chmPathCtrl = wx.TextCtrl(panel, -1)
@ -116,10 +116,10 @@ class PackageDocMainFrame(wx.Frame):
else: else:
self._chmPathCtrl.SetValue('C:\\Program Files\\HTML Help Workshop\\hhc.exe') self._chmPathCtrl.SetValue('C:\\Program Files\\HTML Help Workshop\\hhc.exe')
self._chmPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) self._chmPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
subsizer.Add(self._chmPathCtrl, (3, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._chmPathCtrl, (3, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
subsizer.Add(self._chmPathBt, (3, 2), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(self._chmPathBt, (3, 2), flag=wx.ALIGN_CENTER_VERTICAL)
wx.EVT_BUTTON(self._chmPathBt, self._chmPathBt.GetId(), self.OnBrowsePath) self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._chmPathBt)
subsizer.Add(wx.StaticText(panel, -1, "Output Location : "), (4, 0), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(wx.StaticText(panel, -1, "Output Location : "), (4, 0), flag=wx.ALIGN_CENTER_VERTICAL)
self._outputPathCtrl = wx.ComboBox(panel, -1) self._outputPathCtrl = wx.ComboBox(panel, -1)
@ -130,9 +130,9 @@ class PackageDocMainFrame(wx.Frame):
self._outputPathCtrl.SetValue(list[len(list) - 1]) self._outputPathCtrl.SetValue(list[len(list) - 1])
subsizer.Add(self._outputPathCtrl, (4, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._outputPathCtrl, (4, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
self._outputPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) self._outputPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN))
subsizer.Add(self._outputPathBt, (4, 2), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) subsizer.Add(self._outputPathBt, (4, 2), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
wx.EVT_BUTTON(self._outputPathBt, self._outputPathBt.GetId(), self.OnBrowsePath) self.Bind(wx.EVT_BUTTON, self.OnBrowsePath, self._outputPathBt)
subsizer.Add(wx.StaticText(panel, -1, "Architecture Specified : "), (5, 0), flag=wx.ALIGN_CENTER_VERTICAL) subsizer.Add(wx.StaticText(panel, -1, "Architecture Specified : "), (5, 0), flag=wx.ALIGN_CENTER_VERTICAL)
self._archCtrl = wx.ComboBox(panel, -1, value='ALL', choices=['ALL', 'IA32/MSFT', 'IA32/GNU', 'X64/INTEL', 'X64/GNU', 'IPF/MSFT', 'IPF/GNU', 'EBC/INTEL'], self._archCtrl = wx.ComboBox(panel, -1, value='ALL', choices=['ALL', 'IA32/MSFT', 'IA32/GNU', 'X64/INTEL', 'X64/GNU', 'IPF/MSFT', 'IPF/GNU', 'EBC/INTEL'],
@ -164,7 +164,7 @@ class PackageDocMainFrame(wx.Frame):
def SaveConfigure(self, name, value): def SaveConfigure(self, name, value):
if value ==None or len(value) == 0: if value ==None or len(value) == 0:
return return
config = wx.ConfigBase_Get() config = wx.ConfigBase.Get()
oldvalues = config.Read(name, '').split(';') oldvalues = config.Read(name, '').split(';')
if len(oldvalues) >= 10: if len(oldvalues) >= 10:
oldvalues.remove(oldvalues[0]) oldvalues.remove(oldvalues[0])
@ -177,7 +177,7 @@ class PackageDocMainFrame(wx.Frame):
config.Write(name, ';'.join(oldvalues)) config.Write(name, ';'.join(oldvalues))
def GetConfigure(self, name): def GetConfigure(self, name):
config = wx.ConfigBase_Get() config = wx.ConfigBase.Get()
values = config.Read(name, '').split(';') values = config.Read(name, '').split(';')
list = [] list = []
for item in values: for item in values:
@ -416,10 +416,10 @@ class ProgressDialog(wx.Dialog):
logging.getLogger('').addHandler(self._loghandle) logging.getLogger('').addHandler(self._loghandle)
logging.getLogger('app').addHandler(self._loghandle) logging.getLogger('app').addHandler(self._loghandle)
wx.EVT_BUTTON(self._closeBt, self._closeBt.GetId(), self.OnButtonClose) self.Bind(wx.EVT_BUTTON, self.OnButtonClose, self._closeBt)
wx.EVT_UPDATE_UI(self, self._closeBt.GetId(), self.OnUpdateCloseButton) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateCloseButton)
wx.EVT_BUTTON(self._gotoOuputBt, self._gotoOuputBt.GetId(), self.OnGotoOutput) self.Bind(wx.EVT_BUTTON, self.OnGotoOutput, self._gotoOuputBt)
EVT_LOG(self, self.OnPostLog) self.Bind(EVT_LOG, self.OnPostLog)
self._process = None self._process = None
self._pid = None self._pid = None
@ -720,7 +720,7 @@ class ProgressDialog(wx.Dialog):
lines = f.readlines() lines = f.readlines()
f.close() f.close()
bfound = False bfound = False
for index in xrange(len(lines)): for index in range(len(lines)):
if lines[index].find('<a class="el" href="files.html" target="basefrm">File List</a>') != -1: if lines[index].find('<a class="el" href="files.html" target="basefrm">File List</a>') != -1:
lines[index] = "<!-- %s" % lines[index] lines[index] = "<!-- %s" % lines[index]
bfound = True bfound = True
@ -745,7 +745,7 @@ class ProgressDialog(wx.Dialog):
lines = f.readlines() lines = f.readlines()
f.close() f.close()
bfound = False bfound = False
for index in xrange(len(lines)): for index in range(len(lines)):
if not bfound: if not bfound:
if lines[index].find('<param name="Local" value="files.html">') != -1: if lines[index].find('<param name="Local" value="files.html">') != -1:
lines[index] = '<!-- %s' % lines[index] lines[index] = '<!-- %s' % lines[index]
@ -969,7 +969,7 @@ class ProgressDialog(wx.Dialog):
fd = open(path, 'r') fd = open(path, 'r')
text = fd.read() text = fd.read()
fd.close() fd.close()
except Exception, e: except Exception as e:
self.LogMessage (" <<<Fail to open file %s" % path) self.LogMessage (" <<<Fail to open file %s" % path)
return return
text = text.replace ('.s.dox', '.s') text = text.replace ('.s.dox', '.s')
@ -982,7 +982,7 @@ class ProgressDialog(wx.Dialog):
fd = open(path, 'w') fd = open(path, 'w')
fd.write(text) fd.write(text)
fd.close() fd.close()
except Exception, e: except Exception as e:
self.LogMessage (" <<<Fail to fixup file %s" % path) self.LogMessage (" <<<Fail to fixup file %s" % path)
return return
self.LogMessage(' >>> Finish to fixup .dox postfix for file %s \n' % path) self.LogMessage(' >>> Finish to fixup .dox postfix for file %s \n' % path)
@ -993,7 +993,7 @@ class ProgressDialog(wx.Dialog):
fd = open(path, 'r') fd = open(path, 'r')
lines = fd.readlines() lines = fd.readlines()
fd.close() fd.close()
except Exception, e: except Exception as e:
self.LogMessage (" <<<Fail to open file %s" % path) self.LogMessage (" <<<Fail to open file %s" % path)
return return
for line in lines: for line in lines:
@ -1004,7 +1004,7 @@ class ProgressDialog(wx.Dialog):
fd = open(path, 'w') fd = open(path, 'w')
fd.write("".join(lines)) fd.write("".join(lines))
fd.close() fd.close()
except Exception, e: except Exception as e:
self.LogMessage (" <<<Fail to fixup file %s" % path) self.LogMessage (" <<<Fail to fixup file %s" % path)
return return
self.LogMessage(' >>> Finish to fixup .decdoxygen postfix for file %s \n' % path) self.LogMessage(' >>> Finish to fixup .decdoxygen postfix for file %s \n' % path)

View File

@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
from __future__ import print_function
from __future__ import absolute_import
import os import os
from .message import * from .message import *
@ -67,7 +65,7 @@ class Page(BaseDoxygeItem):
def AddSection(self, section): def AddSection(self, section):
self.mSections.append(section) self.mSections.append(section)
self.mSections.sort(cmp=lambda x, y: cmp(x.mName.lower(), y.mName.lower())) self.mSections.sort(key=lambda x: x.mName.lower())
def Generate(self): def Generate(self):
if self.mIsMainPage: if self.mIsMainPage:
@ -80,7 +78,7 @@ class Page(BaseDoxygeItem):
self.mText.append(self.mDescription) self.mText.append(self.mDescription)
endIndex = len(self.mText) endIndex = len(self.mText)
self.mSections.sort() self.mSections.sort(key=lambda x: x.mName.lower())
for sect in self.mSections: for sect in self.mSections:
self.mText += sect.Generate() self.mText += sect.Generate()
@ -92,7 +90,7 @@ class Page(BaseDoxygeItem):
self.mText.insert(endIndex, '<ul>') self.mText.insert(endIndex, '<ul>')
endIndex += 1 endIndex += 1
if self.mIsSort: if self.mIsSort:
self.mSubPages.sort(cmp=lambda x, y: cmp(x.mName.lower(), y.mName.lower())) self.mSubPages.sort(key=lambda x: x.mName.lower())
for page in self.mSubPages: for page in self.mSubPages:
self.mText.insert(endIndex, '<li>\subpage %s \"%s\" </li>' % (page.mTag, page.mName)) self.mText.insert(endIndex, '<li>\subpage %s \"%s\" </li>' % (page.mTag, page.mName))
endIndex += 1 endIndex += 1

View File

@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
from __future__ import print_function
import array import array
import uuid import uuid
import re import re

View File

@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
from __future__ import absolute_import
from .message import * from .message import *
import re import re
import os import os
@ -25,7 +24,7 @@ class BaseINIFile(object):
@return: instance of this class @return: instance of this class
""" """
if len(args) == 0: return object.__new__(cls, *args, **kwargs) if len(args) == 0: return object.__new__(cls)
filename = args[0] filename = args[0]
parent = None parent = None
if len(args) > 1: if len(args) > 1:
@ -33,7 +32,7 @@ class BaseINIFile(object):
key = os.path.normpath(filename) key = os.path.normpath(filename)
if key not in cls._objs.keys(): if key not in cls._objs.keys():
cls._objs[key] = object.__new__(cls, *args, **kwargs) cls._objs[key] = object.__new__(cls)
if parent is not None: if parent is not None:
cls._objs[key].AddParent(parent) cls._objs[key].AddParent(parent)

View File

@ -10,12 +10,12 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
import plugins.EdkPlugins.basemodel.ini as ini from ...basemodel import ini as ini
import plugins.EdkPlugins.edk2.model.dsc as dsc from ..model import dsc as dsc
import plugins.EdkPlugins.edk2.model.inf as inf from ..model import inf as inf
import plugins.EdkPlugins.edk2.model.dec as dec from ..model import dec as dec
import os import os
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
class SurfaceObject(object): class SurfaceObject(object):
_objs = {} _objs = {}
@ -25,7 +25,7 @@ class SurfaceObject(object):
@return: instance of this class @return: instance of this class
""" """
obj = object.__new__(cls, *args, **kwargs) obj = object.__new__(cls)
if "None" not in cls._objs: if "None" not in cls._objs:
cls._objs["None"] = [] cls._objs["None"] = []
cls._objs["None"].append(obj) cls._objs["None"].append(obj)
@ -846,7 +846,7 @@ class SurfaceItem(object):
ErrorMsg("%s item is duplicated defined in packages: %s and %s" % ErrorMsg("%s item is duplicated defined in packages: %s and %s" %
(name, parent.GetFilename(), cls._objs[name].GetParent().GetFilename())) (name, parent.GetFilename(), cls._objs[name].GetParent().GetFilename()))
return None return None
obj = object.__new__(cls, *args, **kwargs) obj = object.__new__(cls)
cls._objs[name] = obj cls._objs[name] = obj
return obj return obj
elif issubclass(parent.__class__, Module): elif issubclass(parent.__class__, Module):

View File

@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
import plugins.EdkPlugins.basemodel.ini as ini from ...basemodel import ini
import re, os import re, os
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
class DECFile(ini.BaseINIFile): class DECFile(ini.BaseINIFile):

View File

@ -16,7 +16,7 @@
"""This file produce action class to generate doxygen document for edk2 codebase. """This file produce action class to generate doxygen document for edk2 codebase.
The action classes are shared by GUI and command line tools. The action classes are shared by GUI and command line tools.
""" """
import plugins.EdkPlugins.basemodel.doxygen as doxygen from ...basemodel import doxygen
import os import os
try: try:
import wx import wx
@ -24,9 +24,9 @@ try:
except: except:
gInGui = False gInGui = False
import re import re
import plugins.EdkPlugins.edk2.model.inf as inf from ..model import inf
import plugins.EdkPlugins.edk2.model.dec as dec from ..model import dec
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
_ignore_dir = ['.svn', '_svn', 'cvs'] _ignore_dir = ['.svn', '_svn', 'cvs']
_inf_key_description_mapping_table = { _inf_key_description_mapping_table = {
@ -386,7 +386,7 @@ class PackageDocumentAction(DoxygenAction):
configFile.AddFile(path) configFile.AddFile(path)
no = 0 no = 0
for no in xrange(len(lines)): for no in range(len(lines)):
if len(lines[no].strip()) == 0: if len(lines[no].strip()) == 0:
continue continue
if lines[no].strip()[:2] in ['##', '//', '/*', '*/']: if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
@ -1000,7 +1000,7 @@ class PackageDocumentAction(DoxygenAction):
#file = textfile.TextFile(path) #file = textfile.TextFile(path)
try: try:
file = open(path, 'rb') file = open(path, 'r')
except (IOError, OSError) as msg: except (IOError, OSError) as msg:
return None return None

View File

@ -13,7 +13,7 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
import plugins.EdkPlugins.basemodel.doxygen as doxygen from ...basemodel import doxygen
import os import os
try: try:
import wx import wx
@ -21,9 +21,9 @@ try:
except: except:
gInGui = False gInGui = False
import re import re
import plugins.EdkPlugins.edk2.model.inf as inf from ..model import inf
import plugins.EdkPlugins.edk2.model.dec as dec from ..model import dec
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
_ignore_dir = ['.svn', '_svn', 'cvs'] _ignore_dir = ['.svn', '_svn', 'cvs']
_inf_key_description_mapping_table = { _inf_key_description_mapping_table = {
@ -388,7 +388,7 @@ class PackageDocumentAction(DoxygenAction):
configFile.AddFile(path) configFile.AddFile(path)
return return
no = 0 no = 0
for no in xrange(len(lines)): for no in range(len(lines)):
if len(lines[no].strip()) == 0: if len(lines[no].strip()) == 0:
continue continue
if lines[no].strip()[:2] in ['##', '//', '/*', '*/']: if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
@ -1003,7 +1003,7 @@ class PackageDocumentAction(DoxygenAction):
#file = textfile.TextFile(path) #file = textfile.TextFile(path)
try: try:
file = open(path, 'rb') file = open(path, 'r')
except (IOError, OSError) as msg: except (IOError, OSError) as msg:
return None return None

View File

@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
import plugins.EdkPlugins.basemodel.ini as ini from ...basemodel import ini
import re, os import re, os
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
class DSCFile(ini.BaseINIFile): class DSCFile(ini.BaseINIFile):
def GetSectionInstance(self, parent, name, isCombined=False): def GetSectionInstance(self, parent, name, isCombined=False):

View File

@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
import plugins.EdkPlugins.basemodel.ini as ini from ...basemodel import ini
import re, os import re, os
from plugins.EdkPlugins.basemodel.message import * from ...basemodel.message import *
class INFFile(ini.BaseINIFile): class INFFile(ini.BaseINIFile):
_libobjs = {} _libobjs = {}