BaseTools/Scripts: Porting PackageDocumentTools code to use Python3
Porting PackageDocumentTools code to support python2 and python3 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -10,12 +10,12 @@
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
import plugins.EdkPlugins.basemodel.ini as ini
|
||||
import plugins.EdkPlugins.edk2.model.dsc as dsc
|
||||
import plugins.EdkPlugins.edk2.model.inf as inf
|
||||
import plugins.EdkPlugins.edk2.model.dec as dec
|
||||
from ...basemodel import ini
|
||||
from ...edk2.model import dsc
|
||||
from ...edk2.model import inf
|
||||
from ...edk2.model import dec
|
||||
import os
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...basemodel.message import *
|
||||
|
||||
class SurfaceObject(object):
|
||||
_objs = {}
|
||||
@ -655,13 +655,13 @@ class Package(SurfaceObject):
|
||||
return self._pcds
|
||||
|
||||
def GetPpis(self):
|
||||
return self._ppis.values()
|
||||
return list(self._ppis.values())
|
||||
|
||||
def GetProtocols(self):
|
||||
return self._protocols.values()
|
||||
return list(self._protocols.values())
|
||||
|
||||
def GetGuids(self):
|
||||
return self._guids.values()
|
||||
return list(self._guids.values())
|
||||
|
||||
def Destroy(self):
|
||||
for pcd in self._pcds.values():
|
||||
|
@ -11,9 +11,9 @@
|
||||
# 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
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...basemodel.message import *
|
||||
|
||||
class DECFile(ini.BaseINIFile):
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
"""This file produce action class to generate doxygen document for edk2 codebase.
|
||||
The action classes are shared by GUI and command line tools.
|
||||
"""
|
||||
import plugins.EdkPlugins.basemodel.doxygen as doxygen
|
||||
from ...basemodel import doxygen
|
||||
import os
|
||||
try:
|
||||
import wx
|
||||
@ -24,9 +24,9 @@ try:
|
||||
except:
|
||||
gInGui = False
|
||||
import re
|
||||
import plugins.EdkPlugins.edk2.model.inf as inf
|
||||
import plugins.EdkPlugins.edk2.model.dec as dec
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...edk2.model import inf
|
||||
from ...edk2.model import dec
|
||||
from ...basemodel.message import *
|
||||
|
||||
_ignore_dir = ['.svn', '_svn', 'cvs']
|
||||
_inf_key_description_mapping_table = {
|
||||
@ -386,7 +386,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
configFile.AddFile(path)
|
||||
|
||||
no = 0
|
||||
for no in xrange(len(lines)):
|
||||
for no in range(len(lines)):
|
||||
if len(lines[no].strip()) == 0:
|
||||
continue
|
||||
if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
|
||||
@ -1000,7 +1000,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
#file = textfile.TextFile(path)
|
||||
|
||||
try:
|
||||
file = open(path, 'rb')
|
||||
file = open(path, 'r')
|
||||
except (IOError, OSError) as msg:
|
||||
return None
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
import plugins.EdkPlugins.basemodel.doxygen as doxygen
|
||||
from ...basemodel import doxygen
|
||||
import os
|
||||
try:
|
||||
import wx
|
||||
@ -21,9 +21,9 @@ try:
|
||||
except:
|
||||
gInGui = False
|
||||
import re
|
||||
import plugins.EdkPlugins.edk2.model.inf as inf
|
||||
import plugins.EdkPlugins.edk2.model.dec as dec
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...edk2.model import inf
|
||||
from ...edk2.model import dec
|
||||
from ...basemodel.message import *
|
||||
|
||||
_ignore_dir = ['.svn', '_svn', 'cvs']
|
||||
_inf_key_description_mapping_table = {
|
||||
@ -388,7 +388,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
configFile.AddFile(path)
|
||||
return
|
||||
no = 0
|
||||
for no in xrange(len(lines)):
|
||||
for no in range(len(lines)):
|
||||
if len(lines[no].strip()) == 0:
|
||||
continue
|
||||
if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
|
||||
@ -1003,7 +1003,7 @@ class PackageDocumentAction(DoxygenAction):
|
||||
#file = textfile.TextFile(path)
|
||||
|
||||
try:
|
||||
file = open(path, 'rb')
|
||||
file = open(path, 'r')
|
||||
except (IOError, OSError) as msg:
|
||||
return None
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
# 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
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...basemodel.message import *
|
||||
|
||||
class DSCFile(ini.BaseINIFile):
|
||||
def GetSectionInstance(self, parent, name, isCombined=False):
|
||||
|
@ -11,9 +11,9 @@
|
||||
# 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
|
||||
from plugins.EdkPlugins.basemodel.message import *
|
||||
from ...basemodel.message import *
|
||||
|
||||
class INFFile(ini.BaseINIFile):
|
||||
_libobjs = {}
|
||||
|
Reference in New Issue
Block a user