]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/BPDG/BPDG.py
BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / BPDG / BPDG.py
index 284eed65c743548bad48d5aba78087334b72351c..86c44abb67a6c956a7907b4b5e82a18e93cde8a5 100644 (file)
@@ -6,7 +6,7 @@
 #  file of PCD layout for use during the build when the platform integrator selects to use \r
 #  automatic offset calculation.\r
 #\r
-#  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -20,7 +20,8 @@
 ##\r
 # Import Modules\r
 #\r
-import os\r
+from __future__ import print_function\r
+import Common.LongFilePathOs as os\r
 import sys\r
 import encodings.ascii\r
 \r
@@ -33,7 +34,7 @@ import StringTable as st
 import GenVpd\r
 \r
 PROJECT_NAME       = st.LBL_BPDG_LONG_UNI\r
-VERSION            = (st.LBL_BPDG_VERSION + " " + gBUILD_VERSION)\r
+VERSION            = (st.LBL_BPDG_VERSION + " Build " + gBUILD_VERSION)\r
 \r
 ## Tool entrance method\r
 #\r
@@ -57,21 +58,21 @@ def main():
         EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
     elif Options.opt_quiet:\r
         EdkLogger.SetLevel(EdkLogger.QUIET)\r
-    elif Options.debug_level != None:\r
+    elif Options.debug_level is not None:\r
         EdkLogger.SetLevel(Options.debug_level + 1) \r
     else:\r
         EdkLogger.SetLevel(EdkLogger.INFO)\r
                   \r
-    if Options.bin_filename == None:\r
+    if Options.bin_filename is None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -o option to specify the file name for the VPD binary file")  \r
-    if Options.filename == None:\r
+    if Options.filename is None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -m option to specify the file name for the mapping file")  \r
 \r
     Force = False\r
-    if Options.opt_force != None:\r
+    if Options.opt_force is not None:\r
         Force = True\r
 \r
-    if (Args[0] != None) :\r
+    if (Args[0] is not None) :\r
         StartBpdg(Args[0], Options.filename, Options.bin_filename, Force)\r
     else :\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please specify the file which contain the VPD pcd info.",\r
@@ -91,7 +92,7 @@ def MyOptionParser():
     #\r
     # Process command line firstly.\r
     #\r
-    parser = OptionParser(version="%s - Version %s\n" % (PROJECT_NAME, VERSION),\r
+    parser = OptionParser(version="%s - Version %s" % (PROJECT_NAME, VERSION),\r
                           description='',\r
                           prog='BPDG',\r
                           usage=st.LBL_BPDG_USAGE\r
@@ -132,7 +133,7 @@ def MyOptionParser():
 #\r
 def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):\r
     if os.path.exists(VpdFileName) and not Force:\r
-        print "\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName\r
+        print("\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName)\r
         choice = sys.stdin.readline()\r
         if choice.strip().lower() not in ['y', 'yes', '']:\r
             return\r