diff options
author | Yingke Liu <yingke.d.liu@intel.com> | 2015-07-01 05:14:28 +0000 |
---|---|---|
committer | yingke <yingke@Edk2> | 2015-07-01 05:14:28 +0000 |
commit | b40286bbec147233d7ca2daa5c25ed19a7dc5e43 (patch) | |
tree | c7619d70e01c0959b0b70a9d797055b1a1121823 /BaseTools/Source/Python/Rsa2048Sha256Sign | |
parent | e8837eddf327e39fe9a851119f17d7f5fb9b1029 (diff) | |
download | edk2-b40286bbec147233d7ca2daa5c25ed19a7dc5e43.tar.gz edk2-b40286bbec147233d7ca2daa5c25ed19a7dc5e43.tar.bz2 edk2-b40286bbec147233d7ca2daa5c25ed19a7dc5e43.zip |
BaseTools: Do not create an empty file if Rsa2048Sha256Sign was failed.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17774 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Rsa2048Sha256Sign')
-rw-r--r-- | BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py index b83c9d4d42..b3254d82bf 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py @@ -65,7 +65,7 @@ if __name__ == '__main__': 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')
- parser.add_argument("-o", "--output", dest='OutputFile', type=argparse.FileType('wb'), metavar='filename', help="specify the output filename", required=True)
+ parser.add_argument("-o", "--output", dest='OutputFile', type=str, metavar='filename', help="specify the output filename", required=True)
parser.add_argument("--private-key", dest='PrivateKeyFile', type=argparse.FileType('rb'), help="specify the private key filename. If not specified, a test signing key is used.")
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")
@@ -110,10 +110,13 @@ if __name__ == '__main__': args.InputFile.close()
#
- # Save output filename and close output file
+ # Save output filename and check if path exists
#
- args.OutputFileName = args.OutputFile.name
- args.OutputFile.close()
+ OutputDir = os.path.dirname(args.OutputFile)
+ if not os.path.exists(OutputDir):
+ print 'ERROR: The output path does not exist: %s' % OutputDir
+ sys.exit(1)
+ args.OutputFileName = args.OutputFile
#
# Save private key filename and close private key file
|