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.115; helo=mga14.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 2BF53209605D9 for ; Wed, 11 Jul 2018 17:52:36 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 17:52:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,339,1526367600"; d="scan'208";a="66258738" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 11 Jul 2018 17:52:35 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 11 Jul 2018 17:52:35 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 11 Jul 2018 17:52:34 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.81]) with mapi id 14.03.0319.002; Thu, 12 Jul 2018 08:52:32 +0800 From: "Zhu, Yonghong" To: Gary Lin , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH 07/14] BaseTools: Use absolute import in BPDG Thread-Index: AQHUF/6PPWINHh+ovEalklMngYVhx6SKxMuw Date: Thu, 12 Jul 2018 00:52:32 +0000 Message-ID: References: <20180710033107.32359-1-glin@suse.com> <20180710033107.32359-8-glin@suse.com> In-Reply-To: <20180710033107.32359-8-glin@suse.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 07/14] BaseTools: Use absolute import in BPDG X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 00:52:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Gary, I got below error: Traceback (most recent call last): File "C:\TCWork\Edk2\BaseTools\Source\Python\BPDG\BPDG.py", line 34, in <= module> from . import StringTable as st ValueError: Attempted relative import in non-package Best Regards, Zhu Yonghong -----Original Message----- From: Gary Lin [mailto:glin@suse.com]=20 Sent: Tuesday, July 10, 2018 11:31 AM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Gao, Liming Subject: [PATCH 07/14] BaseTools: Use absolute import in BPDG Based on "futurize -f libfuturize.fixes.fix_absolute_import Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Source/Python/BPDG/BPDG.py | 5 +++-- BaseTools/Source/Python/BPDG/GenVpd.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python= /BPDG/BPDG.py index 07cee8976208..2ec1516c0a08 100644 --- a/BaseTools/Source/Python/BPDG/BPDG.py +++ b/BaseTools/Source/Python/BPDG/BPDG.py @@ -21,6 +21,7 @@ # Import Modules # from __future__ import print_function +from __future__ import absolute_import import Common.LongFilePathOs as os import sys import encodings.ascii @@ -30,8 +31,8 @@ from Common import EdkLogger from Common.BuildToolError = import * from Common.BuildVersion import gBUILD_VERSION =20 -import StringTable as st -import GenVpd +from . import StringTable as st +from . import GenVpd =20 PROJECT_NAME =3D st.LBL_BPDG_LONG_UNI VERSION =3D (st.LBL_BPDG_VERSION + " Build " + gBUILD_VERSION) diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Pyth= on/BPDG/GenVpd.py index 2eefcc24905f..cd272a2d9a79 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -13,9 +13,10 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. # =20 +from __future__ import absolute_import import Common.LongFilePathOs as os from io import BytesIO -import StringTable as st +from . import StringTable as st import array import re from Common.LongFilePathSupport import OpenLongFilePath as open -- 2.18.0