From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 372892194D387 for ; Mon, 28 Jan 2019 18:06:40 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2019 18:06:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,535,1539673200"; d="scan'208";a="295229830" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga005.jf.intel.com with ESMTP; 28 Jan 2019 18:06:37 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Zhijux Fan , Bob Feng , Liming Gao , Yonghong Zhu Date: Tue, 29 Jan 2019 10:05:51 +0800 Message-Id: <20190129020610.14300-15-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190129020610.14300-1-bob.c.feng@intel.com> References: <20190129020610.14300-1-bob.c.feng@intel.com> MIME-Version: 1.0 Subject: [Patch 14/33] BaseTools/Scripts: Porting PackageDocumentTools code to use Python3 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 02:06:40 -0000 Content-Transfer-Encoding: 8bit From: Zhijux Fan Porting PackageDocumentTools code to support python2 and python3 Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 2 +- BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py | 6 +++--- BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw | 14 +++++++------- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py | 4 ++-- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py | 16 ++++++++-------- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py | 4 ++-- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py | 12 ++++++------ BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py | 12 ++++++------ BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py | 4 ++-- BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py | 4 ++-- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py index 59eec28d5e..1495ac34d6 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -133,11 +133,11 @@ class parser_lst(object): offset = int(offset, 10) tmp_name = pcdname2_re.findall(t_name)[0] + '[0]' tmp_dict[offset] = tmp_name pcdname_num = int(pcdname_num_re.findall(t_name)[0],10) uint = int(unit_num.findall(uint)[0],10) - bit = uint / 8 + bit = uint // 8 for i in range(1, pcdname_num): offset += bit tmp_name = pcdname2_re.findall(t_name)[0] + '[%s]' % i tmp_dict[offset] = tmp_name else: diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py index 4deeee01a5..e404a07cd7 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py +++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py @@ -14,12 +14,12 @@ from __future__ import print_function import os, sys, logging, traceback, subprocess from optparse import OptionParser -import plugins.EdkPlugins.edk2.model.baseobject as baseobject -import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen +from .plugins.EdkPlugins.edk2.model import baseobject +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', 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', 'IA32_GNU' : 'MDE_CPU_IA32 __GNUC__', 'X64_MSFT' : 'MDE_CPU_X64 _MSC_EXTENSIONS ASM_PFX= OPTIONAL= ', @@ -36,11 +36,11 @@ def parseCmdArgs(): help='Specify the absolute path for package DEC file. For example: c:\\tianocore\\MdePkg\\MdePkg.dec') parser.add_option('-x', '--doxygen', action='store', dest='DoxygenPath', 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', 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') parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'], help='Specify the document mode from : CHM or HTML') parser.add_option('-i', '--includeonly', action='store_true', dest='IncludeOnly', help='Only generate document for package\'s public interfaces produced by include folder. ') diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw b/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw index 28f6f9bf5c..2998db3915 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw +++ b/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw @@ -16,12 +16,12 @@ import os, sys, wx, logging import wx.stc import wx.lib.newevent import wx.lib.agw.genericmessagedialog as GMD -import plugins.EdkPlugins.edk2.model.baseobject as baseobject -import plugins.EdkPlugins.edk2.model.doxygengen as doxygengen +from plugins.EdkPlugins.edk2.model import baseobject +from plugins.EdkPlugins.edk2.model import doxygengen if hasattr(sys, "frozen"): appPath = os.path.abspath(os.path.dirname(sys.executable)) else: appPath = os.path.abspath(os.path.dirname(__file__)) @@ -718,11 +718,11 @@ class ProgressDialog(wx.Dialog): lines = [] f = open (path_html, "r") lines = f.readlines() f.close() bfound = False - for index in xrange(len(lines)): + for index in range(len(lines)): if lines[index].find('File List') != -1: lines[index] = "