From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=zhijux.fan@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 17A33211CED7A for ; Sun, 24 Feb 2019 21:13:24 -0800 (PST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2019 21:13:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,410,1544515200"; d="dat'59?scan'59,208,59";a="124933143" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 24 Feb 2019 21:13:24 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 24 Feb 2019 21:13:23 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 24 Feb 2019 21:13:23 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0415.000; Mon, 25 Feb 2019 13:13:21 +0800 From: "Fan, ZhijuX" To: "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Feng, Bob C" Thread-Topic: [edk2][PATCH V2] BaseTools:PackageDocumentTools import lib error occurs. Thread-Index: AdTMyNGUmAieDC3xTyazKqIMaMr2DQ== Date: Mon, 25 Feb 2019 05:13:20 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [PATCH V2] BaseTools:PackageDocumentTools import lib error occurs. 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: Mon, 25 Feb 2019 05:13:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Steps: 1. Download edk2 tree 2. Build BaseTools 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools to run packagedoc_cli.py An error occurs if relative imports are used when running a file alone Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py | 4 ++-- .../plugins/EdkPlugins/basemodel/doxygen.py | 2 +- .../plugins/EdkPlugins/basemodel/ini.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/baseobject.py | 14 +++++++---= ---- .../plugins/EdkPlugins/edk2/model/dec.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/doxygengen.py | 8 ++++---- .../plugins/EdkPlugins/edk2/model/doxygengen_spec.py | 8 ++++---- .../plugins/EdkPlugins/edk2/model/dsc.py | 4 ++-- .../plugins/EdkPlugins/edk2/model/inf.py | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/Bas= eTools/Scripts/PackageDocumentTools/packagedoc_cli.py index e404a07cd7..5c65842a72 100644 --- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py +++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py @@ -16,8 +16,8 @@ from __future__ import print_function import os, sys, logging, traceback, subprocess from optparse import OptionParser =20 -from .plugins.EdkPlugins.edk2.model import baseobject -from .plugins.EdkPlugins.edk2.model import doxygengen +from plugins.EdkPlugins.edk2.model import baseobject +from plugins.EdkPlugins.edk2.model import doxygengen =20 gArchMarcoDict =3D {'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', diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/base= model/doxygen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugin= s/basemodel/doxygen.py index ae47ff1344..a510808842 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/d= oxygen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/d= oxygen.py @@ -92,7 +92,7 @@ class Page(BaseDoxygeItem): self.mText.insert(endIndex, '
    ') endIndex +=3D 1 if self.mIsSort: - self.mSubPages.sort(cmp=3Dlambda x, y: cmp(x.mName.lower()= , y.mName.lower())) + self.mSubPages.sort(key=3Dlambda x: x.mName.lower()) for page in self.mSubPages: self.mText.insert(endIndex, '
  • \subpage %s \"%s\"
  • '= % (page.mTag, page.mName)) endIndex +=3D 1 diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/base= model/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/ba= semodel/ini.py index 6e6f3f4b97..bac2f5e2e6 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/i= ni.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/i= ni.py @@ -25,7 +25,7 @@ class BaseINIFile(object): @return: instance of this class =20 """ - if len(args) =3D=3D 0: return object.__new__(cls, *args, **kwargs) + if len(args) =3D=3D 0: return object.__new__(cls) filename =3D args[0] parent =3D None if len(args) > 1: @@ -33,7 +33,7 @@ class BaseINIFile(object): =20 key =3D os.path.normpath(filename) if key not in cls._objs.keys(): - cls._objs[key] =3D object.__new__(cls, *args, **kwargs) + cls._objs[key] =3D object.__new__(cls) =20 if parent is not None: cls._objs[key].AddParent(parent) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/baseobject.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPl= ugins/edk2/model/baseobject.py index 0159bd5269..7b47fd76b9 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= baseobject.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= baseobject.py @@ -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 IMP= LIED. =20 -from ...basemodel import ini -from ...edk2.model import dsc -from ...edk2.model import inf -from ...edk2.model import dec +from plugins.EdkPlugins.basemodel import ini +from plugins.EdkPlugins.edk2.model import dsc +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec import os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * =20 class SurfaceObject(object): _objs =3D {} @@ -25,7 +25,7 @@ class SurfaceObject(object): @return: instance of this class =20 """ - obj =3D object.__new__(cls, *args, **kwargs) + obj =3D object.__new__(cls) if "None" not in cls._objs: cls._objs["None"] =3D [] cls._objs["None"].append(obj) @@ -846,7 +846,7 @@ class SurfaceItem(object): ErrorMsg("%s item is duplicated defined in packages: %s an= d %s" % (name, parent.GetFilename(), cls._objs[name].GetP= arent().GetFilename())) return None - obj =3D object.__new__(cls, *args, **kwargs) + obj =3D object.__new__(cls) cls._objs[name] =3D obj return obj elif issubclass(parent.__class__, Module): diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/dec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/e= dk2/model/dec.py index 3d210f72ac..568076547b 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= dec.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= dec.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from ...basemodel import ini +from plugins.EdkPlugins.basemodel import ini import re, os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * =20 class DECFile(ini.BaseINIFile): =20 diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/doxygengen.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPl= ugins/edk2/model/doxygengen.py index 9c299fbfc5..e31df262bc 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= doxygengen.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= doxygengen.py @@ -16,7 +16,7 @@ """This file produce action class to generate doxygen document for edk2 co= debase. The action classes are shared by GUI and command line tools. """ -from ...basemodel import doxygen +from plugins.EdkPlugins.basemodel import doxygen import os try: import wx @@ -24,9 +24,9 @@ try: except: gInGui =3D False import re -from ...edk2.model import inf -from ...edk2.model import dec -from ...basemodel.message import * +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec +from plugins.EdkPlugins.basemodel.message import * =20 _ignore_dir =3D ['.svn', '_svn', 'cvs'] _inf_key_description_mapping_table =3D { diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/doxygengen_spec.py b/BaseTools/Scripts/PackageDocumentTools/plugins/= EdkPlugins/edk2/model/doxygengen_spec.py index 3a862a92ea..279b7fb8d4 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= doxygengen_spec.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= doxygengen_spec.py @@ -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 IMP= LIED. =20 -from ...basemodel import doxygen +from plugins.EdkPlugins.basemodel import doxygen import os try: import wx @@ -21,9 +21,9 @@ try: except: gInGui =3D False import re -from ...edk2.model import inf -from ...edk2.model import dec -from ...basemodel.message import * +from plugins.EdkPlugins.edk2.model import inf +from plugins.EdkPlugins.edk2.model import dec +from plugins.EdkPlugins.basemodel.message import * =20 _ignore_dir =3D ['.svn', '_svn', 'cvs'] _inf_key_description_mapping_table =3D { diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/dsc.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/e= dk2/model/dsc.py index 6f59e566b8..9c57f6f41f 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= dsc.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= dsc.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from ...basemodel import ini +from plugins.EdkPlugins.basemodel import ini import re, os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * =20 class DSCFile(ini.BaseINIFile): def GetSectionInstance(self, parent, name, isCombined=3DFalse): diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2= /model/inf.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/e= dk2/model/inf.py index cf2e49d3af..c5f03841d3 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= inf.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/= inf.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from ...basemodel import ini +from plugins.EdkPlugins.basemodel import ini import re, os -from ...basemodel.message import * +from plugins.EdkPlugins.basemodel.message import * =20 class INFFile(ini.BaseINIFile): _libobjs =3D {} --=20 2.14.1.windows.1