Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: tools/usb_gadget/package.py

Issue 799073005: Write the packaged USB gadget app in binary mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utility to package and upload the USB gadget framework. 6 """Utility to package and upload the USB gadget framework.
7 """ 7 """
8 8
9 import argparse 9 import argparse
10 import hashlib 10 import hashlib
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 '--upload', type=str, metavar='HOST[:PORT]', 75 '--upload', type=str, metavar='HOST[:PORT]',
76 help='upload package to target system') 76 help='upload package to target system')
77 parser.add_argument( 77 parser.add_argument(
78 'files', metavar='FILE', type=str, nargs='*', 78 'files', metavar='FILE', type=str, nargs='*',
79 help='source files') 79 help='source files')
80 80
81 args = parser.parse_args() 81 args = parser.parse_args()
82 82
83 content, md5 = MakeZip(directory=args.dir, files=args.files) 83 content, md5 = MakeZip(directory=args.dir, files=args.files)
84 if args.zip_file: 84 if args.zip_file:
85 with open(args.zip_file, 'w') as zip_file: 85 with open(args.zip_file, 'wb') as zip_file:
86 zip_file.write(content) 86 zip_file.write(content)
87 if args.hash_file: 87 if args.hash_file:
88 with open(args.hash_file, 'w') as hash_file: 88 with open(args.hash_file, 'wb') as hash_file:
89 hash_file.write(md5) 89 hash_file.write(md5)
90 if args.upload: 90 if args.upload:
91 UploadZip(content, md5, args.upload) 91 UploadZip(content, md5, args.upload)
92 92
93 93
94 if __name__ == '__main__': 94 if __name__ == '__main__':
95 main() 95 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698