public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue
@ 2018-10-25  5:51 Feng, YunhuaX
  2018-10-26  2:37 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, YunhuaX @ 2018-10-25  5:51 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming

Fix BPDG tool print traceback info issue
and remove abundant code

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/BPDG/BPDG.py          | 5 ++++-
 BaseTools/Source/Python/Common/VpdInfoFile.py | 5 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python/BPDG/BPDG.py
index 2ec1516c0a..c30e062a69 100644
--- a/BaseTools/Source/Python/BPDG/BPDG.py
+++ b/BaseTools/Source/Python/BPDG/BPDG.py
@@ -151,11 +151,14 @@ def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
     GenVPD.GenerateVpdFile(MapFileName, VpdFileName)
 
     EdkLogger.info("- Vpd pcd fixed done! -")
 
 if __name__ == '__main__':
-    r = main()
+    try:
+        r = main()
+    except FatalError as e:
+        r = e
     ## 0-127 is a safe return range, and 1 is a standard default error
     if r < 0 or r > 127: r = 1
     sys.exit(r)
 
 
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 0485bf482e..2fb8e66fe9 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -252,11 +252,10 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
     print(out)
     while PopenObject.returncode is None :
         PopenObject.wait()
 
     if PopenObject.returncode != 0:
-        if PopenObject.returncode != 0:
-            EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
-            EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
+        EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
+        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
                             (PopenObject.returncode, str(error)))
 
     return PopenObject.returncode
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue
  2018-10-25  5:51 [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue Feng, YunhuaX
@ 2018-10-26  2:37 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-10-26  2:37 UTC (permalink / raw)
  To: Feng, YunhuaX, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Feng, YunhuaX 
Sent: Thursday, October 25, 2018 1:51 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue

Fix BPDG tool print traceback info issue and remove abundant code

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/BPDG/BPDG.py          | 5 ++++-
 BaseTools/Source/Python/Common/VpdInfoFile.py | 5 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python/BPDG/BPDG.py
index 2ec1516c0a..c30e062a69 100644
--- a/BaseTools/Source/Python/BPDG/BPDG.py
+++ b/BaseTools/Source/Python/BPDG/BPDG.py
@@ -151,11 +151,14 @@ def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
     GenVPD.GenerateVpdFile(MapFileName, VpdFileName)
 
     EdkLogger.info("- Vpd pcd fixed done! -")
 
 if __name__ == '__main__':
-    r = main()
+    try:
+        r = main()
+    except FatalError as e:
+        r = e
     ## 0-127 is a safe return range, and 1 is a standard default error
     if r < 0 or r > 127: r = 1
     sys.exit(r)
 
 
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 0485bf482e..2fb8e66fe9 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -252,11 +252,10 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
     print(out)
     while PopenObject.returncode is None :
         PopenObject.wait()
 
     if PopenObject.returncode != 0:
-        if PopenObject.returncode != 0:
-            EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
-            EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
+        EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
+        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail 
+ to execute BPDG tool with exit code: %d, the error message is: \n %s" 
+ % \
                             (PopenObject.returncode, str(error)))
 
     return PopenObject.returncode
--
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-26  2:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-25  5:51 [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue Feng, YunhuaX
2018-10-26  2:37 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox