public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: Gary Lin <glin@suse.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>,
	"Zhu, Yonghong" <yonghong.zhu@intel.com>
Subject: Re: [PATCH 07/14] BaseTools: Use absolute import in BPDG
Date: Thu, 12 Jul 2018 00:52:32 +0000	[thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D520BBD2D@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20180710033107.32359-8-glin@suse.com>

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] 
Sent: Tuesday, July 10, 2018 11:31 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
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 <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 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
 
-import StringTable as st
-import GenVpd
+from . import StringTable as st
+from . import GenVpd
 
 PROJECT_NAME       = st.LBL_BPDG_LONG_UNI
 VERSION            = (st.LBL_BPDG_VERSION + " Build " + gBUILD_VERSION)
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/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 IMPLIED.
 #
 
+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



  reply	other threads:[~2018-07-12  0:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10  3:30 [PATCH 00/14] BaseTools: Adopt absolute import Gary Lin
2018-07-10  3:30 ` [PATCH 01/14] BaseTools: Treat GenFds.py as a python module Gary Lin
2018-07-10  3:30 ` [PATCH 02/14] BaseTools: Use absolute import in GenFds Gary Lin
2018-07-10  3:30 ` [PATCH 03/14] BaseTools: Move OverrideAttribs to OptRomInfStatement.py Gary Lin
2018-07-10  3:30 ` [PATCH 04/14] BaseTools: Move FindExtendTool to GenFdsGlobalVariable.py Gary Lin
2018-07-10  3:30 ` [PATCH 05/14] BaseTools: Move ImageBinDict " Gary Lin
2018-07-10  3:30 ` [PATCH 06/14] BaseTools: Use absolute import in AutoGen Gary Lin
2018-07-10  3:31 ` [PATCH 07/14] BaseTools: Use absolute import in BPDG Gary Lin
2018-07-12  0:52   ` Zhu, Yonghong [this message]
2018-07-12  4:23     ` Gary Lin
2018-07-10  3:31 ` [PATCH 08/14] BaseTools: Use absolute import in Common Gary Lin
2018-07-10  3:31 ` [PATCH 09/14] BaseTools: Use absolute import in ECC Gary Lin
2018-07-10  3:31 ` [PATCH 10/14] BaseTools: Use absolute import in Eot Gary Lin
2018-07-10  3:31 ` [PATCH 11/14] BaseTools: Use absolute import in Table Gary Lin
2018-07-10  3:31 ` [PATCH 12/14] BaseTools: Use absolute import in UPT Gary Lin
2018-07-10  3:31 ` [PATCH 13/14] BaseTools: Use absolute import in Workspace Gary Lin
2018-07-10  3:31 ` [PATCH 14/14] BaseTools: Use absolute import in Scripts Gary Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D520BBD2D@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox