X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FScripts%2FUpdateBuildVersions.py;h=269435bfa4cba59cfcb8b63f66bd4a58d7bf7ae5;hp=e9c069724e48ea99ac2fe9a1710f25e5efd97cbd;hb=2add3cffb075de8a705c9d887dd25624c89d2349;hpb=bf47c6a11b1fca90fe17070e0197963d4d586603 diff --git a/BaseTools/Scripts/UpdateBuildVersions.py b/BaseTools/Scripts/UpdateBuildVersions.py index e9c069724e..269435bfa4 100755 --- a/BaseTools/Scripts/UpdateBuildVersions.py +++ b/BaseTools/Scripts/UpdateBuildVersions.py @@ -6,7 +6,7 @@ # If SVN is available, the tool will obtain the current checked out version of # the source tree for including the the --version commands. -# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -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" __execname__ = "UpdateBuildVersions.py" -SVN_REVISION = "$Revision: 3 $" -SVN_REVISION = SVN_REVISION.replace("$Revision:", "").replace("$", "").strip() +SVN_REVISION = "$LastChangedRevision: 3 $" +SVN_REVISION = SVN_REVISION.replace("$LastChangedRevision:", "").replace("$", "").strip() __copyright__ = "Copyright (c) 2014, Intel Corporation. All rights reserved." VERSION_NUMBER = "0.7.0" __version__ = "Version %s.%s" % (VERSION_NUMBER, SVN_REVISION) @@ -90,7 +90,8 @@ def ShellCommandResults(CmdLine, Opt): sys.stderr.flush() returnValue = err_val.returncode - except IOError as (errno, strerror): + except IOError as err_val: + (errno, strerror) = err_val.args file_list.close() if not Opt.silent: sys.stderr.write("I/O ERROR : %s : %s\n" % (str(errno), strerror)) @@ -100,7 +101,8 @@ def ShellCommandResults(CmdLine, Opt): sys.stderr.flush() returnValue = errno - except OSError as (errno, strerror): + except OSError as err_val: + (errno, strerror) = err_val.args file_list.close() if not Opt.silent: sys.stderr.write("OS ERROR : %s : %s\n" % (str(errno), strerror)) @@ -210,13 +212,15 @@ def RevertCmd(Filename, Opt): sys.stderr.write("Subprocess ERROR : %s\n" % err_val) sys.stderr.flush() - except IOError as (errno, strerror): + except IOError as err_val: + (errno, strerror) = err_val.args if not Opt.silent: sys.stderr.write("I/O ERROR : %d : %s\n" % (str(errno), strerror)) sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine) sys.stderr.flush() - except OSError as (errno, strerror): + except OSError as err_val: + (errno, strerror) = err_val.args if not Opt.silent: sys.stderr.write("OS ERROR : %d : %s\n" % (str(errno), strerror)) sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine) @@ -249,7 +253,7 @@ def GetSvnRevision(opts): StatusCmd = "svn st -v --depth infinity --non-interactive" contents = ShellCommandResults(StatusCmd, opts) os.chdir(Cwd) - if type(contents) is ListType: + if isinstance(contents, ListType): for line in contents: if line.startswith("M "): Modified = True @@ -259,7 +263,7 @@ def GetSvnRevision(opts): InfoCmd = "svn info %s" % SrcPath.replace("\\", "/").strip() Revision = 0 contents = ShellCommandResults(InfoCmd, opts) - if type(contents) is IntType: + if isinstance(contents, IntType): return 0, Modified for line in contents: line = line.strip() @@ -280,7 +284,7 @@ def CheckSvn(opts): VerCmd = "svn --version" contents = ShellCommandResults(VerCmd, opts) opts.silent = OriginalSilent - if type(contents) is IntType: + if isinstance(contents, IntType): if opts.verbose: sys.stdout.write("SVN does not appear to be available.\n") sys.stdout.flush()