]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
Revert BaseTools: PYTHON3 migration
[mirror_edk2.git] / BaseTools / Source / Python / Pkcs7Sign / Pkcs7Sign.py
index 14e92a5d8b5fd7ad95b4a10a8b07cc11c5772429..a44781f2e8399fee455244cd1d45147abb8803bd 100644 (file)
@@ -19,6 +19,7 @@
 '''\r
 Pkcs7Sign\r
 '''\r
+from __future__ import print_function\r
 \r
 import os\r
 import sys\r
@@ -75,9 +76,8 @@ if __name__ == '__main__':
   #\r
   # Create command line argument parser object\r
   #\r
-  parser = argparse.ArgumentParser(prog=__prog__, usage=__usage__, description=__copyright__, conflict_handler='resolve')\r
+  parser = argparse.ArgumentParser(prog=__prog__, version=__version__, usage=__usage__, description=__copyright__, conflict_handler='resolve')\r
   group = parser.add_mutually_exclusive_group(required=True)\r
-  group.add_argument("--version", action='version', version=__version__)\r
   group.add_argument("-e", action="store_true", dest='Encode', help='encode file')\r
   group.add_argument("-d", action="store_true", dest='Decode', help='decode file')\r
   parser.add_argument("-o", "--output", dest='OutputFile', type=str, metavar='filename', help="specify the output filename", required=True)\r
@@ -121,7 +121,7 @@ if __name__ == '__main__':
   if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
-  print(Version[0].decode())\r
+  print(Version[0])\r
 \r
   #\r
   # Read input file into a buffer and save input filename\r
@@ -141,11 +141,11 @@ if __name__ == '__main__':
 \r
   try:\r
     if args.MonotonicCountStr.upper().startswith('0X'):\r
-      args.MonotonicCountValue = (int)(args.MonotonicCountStr, 16)\r
+      args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)\r
     else:\r
-      args.MonotonicCountValue = (int)(args.MonotonicCountStr)\r
+      args.MonotonicCountValue = (long)(args.MonotonicCountStr)\r
   except:\r
-    args.MonotonicCountValue = (int)(0)\r
+    args.MonotonicCountValue = (long)(0)\r
 \r
   if args.Encode:\r
     #\r
@@ -251,9 +251,9 @@ if __name__ == '__main__':
       sys.exit(1)\r
     else:\r
       if args.SignatureSizeStr.upper().startswith('0X'):\r
-        SignatureSize = (int)(args.SignatureSizeStr, 16)\r
+        SignatureSize = (long)(args.SignatureSizeStr, 16)\r
       else:\r
-        SignatureSize = (int)(args.SignatureSizeStr)\r
+        SignatureSize = (long)(args.SignatureSizeStr)\r
     if SignatureSize < 0:\r
         print("ERROR: The value of option --signature-size can't be set to negative value!")\r
         sys.exit(1)\r