]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/UpdateBuildVersions.py
BaseTools: Use absolute import in Scripts
[mirror_edk2.git] / BaseTools / Scripts / UpdateBuildVersions.py
old mode 100644 (file)
new mode 100755 (executable)
index e9c0697..269435b
@@ -6,7 +6,7 @@
 # If SVN is available, the tool will obtain the current checked out version of\r
 # the source tree for including the the --version commands.\r
 \r
-#  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2014 - 2015, 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
@@ -32,8 +32,8 @@ from types import IntType, ListType
 SYS_ENV_ERR = "ERROR : %s system environment variable must be set prior to running this tool.\n"\r
 \r
 __execname__ = "UpdateBuildVersions.py"\r
-SVN_REVISION = "$Revision: 3 $"\r
-SVN_REVISION = SVN_REVISION.replace("$Revision:", "").replace("$", "").strip()\r
+SVN_REVISION = "$LastChangedRevision: 3 $"\r
+SVN_REVISION = SVN_REVISION.replace("$LastChangedRevision:", "").replace("$", "").strip()\r
 __copyright__ = "Copyright (c) 2014, Intel Corporation. All rights reserved."\r
 VERSION_NUMBER = "0.7.0"\r
 __version__ = "Version %s.%s" % (VERSION_NUMBER, SVN_REVISION)\r
@@ -90,7 +90,8 @@ def ShellCommandResults(CmdLine, Opt):
             sys.stderr.flush()\r
         returnValue = err_val.returncode\r
 \r
-    except IOError as (errno, strerror):\r
+    except IOError as err_val:\r
+        (errno, strerror) = err_val.args\r
         file_list.close()\r
         if not Opt.silent:\r
             sys.stderr.write("I/O ERROR : %s : %s\n" % (str(errno), strerror))\r
@@ -100,7 +101,8 @@ def ShellCommandResults(CmdLine, Opt):
             sys.stderr.flush()\r
         returnValue = errno\r
 \r
-    except OSError as (errno, strerror):\r
+    except OSError as err_val:\r
+        (errno, strerror) = err_val.args\r
         file_list.close()\r
         if not Opt.silent:\r
             sys.stderr.write("OS ERROR : %s : %s\n" % (str(errno), strerror))\r
@@ -210,13 +212,15 @@ def RevertCmd(Filename, Opt):
             sys.stderr.write("Subprocess ERROR : %s\n" % err_val)\r
             sys.stderr.flush()\r
 \r
-    except IOError as (errno, strerror):\r
+    except IOError as err_val:\r
+        (errno, strerror) = err_val.args\r
         if not Opt.silent:\r
             sys.stderr.write("I/O ERROR : %d : %s\n" % (str(errno), strerror))\r
             sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)\r
             sys.stderr.flush()\r
 \r
-    except OSError as (errno, strerror):\r
+    except OSError as err_val:\r
+        (errno, strerror) = err_val.args\r
         if not Opt.silent:\r
             sys.stderr.write("OS ERROR : %d : %s\n" % (str(errno), strerror))\r
             sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)\r
@@ -249,7 +253,7 @@ def GetSvnRevision(opts):
     StatusCmd = "svn st -v --depth infinity --non-interactive"\r
     contents = ShellCommandResults(StatusCmd, opts)\r
     os.chdir(Cwd)\r
-    if type(contents) is ListType:\r
+    if isinstance(contents, ListType):\r
         for line in contents:\r
             if line.startswith("M "):\r
                 Modified = True\r
@@ -259,7 +263,7 @@ def GetSvnRevision(opts):
     InfoCmd = "svn info %s" % SrcPath.replace("\\", "/").strip()\r
     Revision = 0\r
     contents = ShellCommandResults(InfoCmd, opts)\r
-    if type(contents) is IntType:\r
+    if isinstance(contents, IntType):\r
         return 0, Modified\r
     for line in contents:\r
         line = line.strip()\r
@@ -280,7 +284,7 @@ def CheckSvn(opts):
     VerCmd = "svn --version"\r
     contents = ShellCommandResults(VerCmd, opts)\r
     opts.silent = OriginalSilent\r
-    if type(contents) is IntType:\r
+    if isinstance(contents, IntType):\r
         if opts.verbose:\r
             sys.stdout.write("SVN does not appear to be available.\n")\r
             sys.stdout.flush()\r