Revision: 15805
          http://sourceforge.net/p/edk2/code/15805
Author:   mdkinney
Date:     2014-08-14 20:08:17 +0000 (Thu, 14 Aug 2014)
Log Message:
-----------
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney  <[email protected]>
Reviewed-by: lhauch <[email protected]>

Fix the behavior of the ?\226?\128?\147version flag in the Rsa2048Sha256 tools 
and update logic for showing program name, version, usage, and copyright 
information to match other BaseTools.

Modified Paths:
--------------
    
trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
    trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py

Modified: 
trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
===================================================================
--- 
trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
   2014-08-14 17:58:16 UTC (rev 15804)
+++ 
trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
   2014-08-14 20:08:17 UTC (rev 15805)
@@ -27,22 +27,22 @@
 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 @@
   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

Modified: 
trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py   
2014-08-14 17:58:16 UTC (rev 15804)
+++ trunk/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py   
2014-08-14 20:08:17 UTC (rev 15805)
@@ -25,8 +25,17 @@
 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
 #
 EFI_HASH_ALGORITHM_SHA256_GUID = 
uuid.UUID('{51aa59de-fdf2-4ea3-bc63-875fb7842ee9}')
@@ -50,19 +59,9 @@
 
 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 @@
   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")
 
   #

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to