Index: chrome/browser/resources/chromeos/chromevox/tools/upload_chromevox_to_webstore.py |
diff --git a/chrome/browser/resources/chromeos/chromevox/tools/upload_chromevox_to_webstore.py b/chrome/browser/resources/chromeos/chromevox/tools/upload_chromevox_to_webstore.py |
index 3b91110ad759030bffc905c886f32597ecbc63c8..d5699fbf181261355e1021d9b8a5e26e420b5252 100755 |
--- a/chrome/browser/resources/chromeos/chromevox/tools/upload_chromevox_to_webstore.py |
+++ b/chrome/browser/resources/chromeos/chromevox/tools/upload_chromevox_to_webstore.py |
@@ -32,7 +32,7 @@ def CreateOptionParser(): |
parser.usage = '%prog <extension_path> <output_path> <client_secret' |
return parser |
-def MakeManifestEdits(root, old): |
+def MakeManifestEdits(root, old, new_file): |
'''Customize a manifest for the webstore. |
Args: |
@@ -40,16 +40,16 @@ def MakeManifestEdits(root, old): |
old: A json file. |
+ new_file: a temporary file to place the manifest in. |
+ |
Returns: |
File of the new manifest. |
''' |
- new_file = tempfile.NamedTemporaryFile() |
- new = new_file.name |
with open(os.path.join(root, old)) as old_file: |
new_contents = json.loads(old_file.read()) |
new_contents.pop('key', '') |
- new_file.write(json.dumps(new_contents)) |
- return new_file |
+ new_file.file.write(json.dumps(new_contents)) |
+ new_file.file.flush() |
dmazzoni
2014/08/28 23:13:01
As an alternative to calling flush, pass bufsize =
David Tseng
2014/08/29 21:12:49
Done.
|
def RunInteractivePrompt(client_secret, output_path): |
input = '' |
@@ -62,13 +62,18 @@ def RunInteractivePrompt(client_secret, output_path): |
input = raw_input('Please select an option: ') |
input = input.strip() |
if input == 'g': |
- chromevox_webstore_util.GetUploadStatus(client_secret) |
+ print ('Upload status: %s' % |
+ chromevox_webstore_util.GetUploadStatus(client_secret).read()) |
elif input == 'u': |
- chromevox_webstore_util.PostUpload(output_path, client_secret) |
+ print ('Uploaded with status: %s' % |
+ chromevox_webstore_util.PostUpload(output_path, client_secret)) |
elif input == 't': |
- chromevox_webstore_util.PostPublishTrustedTesters(client_secret) |
+ print ('Published to trusted testers with status: %s' % |
+ chromevox_webstore_util.PostPublishTrustedTesters( |
+ client_secret).read()) |
elif input == 'p': |
- chromevox_webstore_util.PostPublish(client_secret) |
+ print ('Published to public with status: %s' % |
+ chromevox_webstore_util.PostPublish(client_secret).read()) |
elif input == 'q': |
sys.exit() |
else: |
@@ -92,14 +97,17 @@ def main(): |
if extension_file in EXCLUDE_FILES: |
continue |
if extension_file == 'manifest.json': |
- new_file = MakeManifestEdits(root, extension_file) |
+ new_file = tempfile.NamedTemporaryFile(mode='w+a') |
+ MakeManifestEdits(root, extension_file, new_file) |
zip.write( |
new_file.name, os.path.join(rel_path, extension_file)) |
continue |
zip.write(os.path.join(root, extension_file), |
os.path.join(rel_path, extension_file)) |
- RunInteractivePrompt(client_secret, output_path) |
+ print 'Created ChromeVox zip file in %s' % output_path |
+ print 'Please run manual smoke tests before proceeding.' |
+ RunInteractivePrompt(client_secret, output_path) |
if __name__ == '__main__': |