summaryrefslogtreecommitdiff
path: root/BaseTools
diff options
context:
space:
mode:
authorMichael Kinney <michael.d.kinney@intel.com>2014-08-14 20:08:17 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-14 20:08:17 +0000
commitc9df168fa0e1a797c72ee7eab2ec0cbfc3c5174b (patch)
tree2f5046b1cdb7baa1648b592992592dc988f117b7 /BaseTools
parente8a57ade2adbdb7830290c44bccd5b7137c80c09 (diff)
downloadedk2-platforms-c9df168fa0e1a797c72ee7eab2ec0cbfc3c5174b.tar.xz
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: lhauch <larry.hauch@intel.com> Fix the behavior of the –version flag in the Rsa2048Sha256 tools and update logic for showing program name, version, usage, and copyright information to match other BaseTools. git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15805 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py24
-rw-r--r--BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py23
2 files changed, 21 insertions, 26 deletions
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
index 630670ef6d..0b1624ab1b 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -27,22 +27,22 @@ import os
import sys
import argparse
import subprocess
+from Common.BuildVersion import gBUILD_VERSION
+
+#
+# Globals for help information
+#
+__prog__ = 'Rsa2048Sha256GenerateKeys'
+__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
+__copyright__ = 'Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.'
+__usage__ = '%s [options]' % (__prog__)
+
if __name__ == '__main__':
#
- # Save name of the program
- #
- ProgramName = sys.argv[0]
-
- #
- # Print copyright
- #
- print '%s - Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.' % (ProgramName)
-
- #
# Create command line argument parser object
#
- parser = argparse.ArgumentParser(prog=ProgramName, usage='%(prog)s [options]', add_help=False)
+ parser = argparse.ArgumentParser(prog=__prog__, version=__version__, usage=__usage__, description=__copyright__, conflict_handler='resolve')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-o", "--output", dest='OutputFile', type=argparse.FileType('wb'), metavar='filename', nargs='*', help="specify the output private key filename in PEM format")
group.add_argument("-i", "--input", dest='InputFile', type=argparse.FileType('rb'), metavar='filename', nargs='*', help="specify the input private key filename in PEM format")
@@ -51,8 +51,6 @@ if __name__ == '__main__':
parser.add_argument("-v", "--verbose", dest='Verbose', action="store_true", help="increase output messages")
parser.add_argument("-q", "--quiet", dest='Quiet', action="store_true", help="reduce output messages")
parser.add_argument("--debug", dest='Debug', type=int, metavar='[0-9]', choices=range(0,10), default=0, help="set debug level")
- parser.add_argument("--version", dest='Version', action="store_true", help="display the program version and exit")
- parser.add_argument("-h", "--help", dest='Help', action="help", help="display this help text")
#
# Parse command line arguments
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index b4c9aa4ce4..b83c9d4d42 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -25,6 +25,15 @@ import subprocess
import uuid
import struct
import collections
+from Common.BuildVersion import gBUILD_VERSION
+
+#
+# Globals for help information
+#
+__prog__ = 'Rsa2048Sha256Sign'
+__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
+__copyright__ = 'Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.'
+__usage__ = '%s -e|-d [options] <input_file>' % (__prog__)
#
# GUID for SHA 256 Hash Algorithm from UEFI Specification
@@ -50,19 +59,9 @@ TEST_SIGNING_PRIVATE_KEY_FILENAME = 'TestSigningPrivateKey.pem'
if __name__ == '__main__':
#
- # Save name of the program
- #
- ProgramName = sys.argv[0]
-
- #
- # Print copyright
- #
- print '%s - Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.' % (ProgramName)
-
- #
# Create command line argument parser object
#
- parser = argparse.ArgumentParser(prog=ProgramName, usage='%(prog)s -e|-d [options] <input_file>', add_help=False)
+ parser = argparse.ArgumentParser(prog=__prog__, version=__version__, usage=__usage__, description=__copyright__, conflict_handler='resolve')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-e", action="store_true", dest='Encode', help='encode file')
group.add_argument("-d", action="store_true", dest='Decode', help='decode file')
@@ -71,8 +70,6 @@ if __name__ == '__main__':
parser.add_argument("-v", "--verbose", dest='Verbose', action="store_true", help="increase output messages")
parser.add_argument("-q", "--quiet", dest='Quiet', action="store_true", help="reduce output messages")
parser.add_argument("--debug", dest='Debug', type=int, metavar='[0-9]', choices=range(0,10), default=0, help="set debug level")
- parser.add_argument("--version", dest='Version', action="store_true", help="display the program version and exit")
- parser.add_argument("-h", "--help", dest='Help', action="help", help="display this help text")
parser.add_argument(metavar="input_file", dest='InputFile', type=argparse.FileType('rb'), help="specify the input filename")
#