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

Unified Diff: pkg/docgen/bin/uploadsdk.py

Issue 18999006: Added a uploadsdk python script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/bin/uploadsdk.py
diff --git a/pkg/docgen/bin/uploadsdk.py b/pkg/docgen/bin/uploadsdk.py
new file mode 100644
index 0000000000000000000000000000000000000000..8492666858d8ebb424ab2870f596a7197ef09475
--- /dev/null
+++ b/pkg/docgen/bin/uploadsdk.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+import platform
+import subprocess
+import sys
+sys.path.insert(0, '../../../tools')
Emily Fortuna 2013/07/10 21:23:32 sys.path.append(and then again, get an absolute pa
+import utils
+
Emily Fortuna 2013/07/10 21:23:32 please add a doc comment """...""" explaining how
+DART = '../../../' + utils.BUILD_ROOT[utils.GuessOS()] \
Emily Fortuna 2013/07/10 21:23:32 absolute path is better than a relative path becau
+ + '/ReleaseIA32/dart-sdk/bin/dart'
Emily Fortuna 2013/07/10 21:23:32 +2 spaces. Also you can group this in () instead o
janicejl 2013/07/11 00:02:08 Done.
+GSUTIL = '../../../third_party/gsutil/gsutil'
Emily Fortuna 2013/07/10 21:23:32 please create an absoulte path instead.
janicejl 2013/07/11 00:02:08 Done.
+HAS_SHELL = False
+if platform.system() == 'Windows':
+ HAS_SHELL = True
+GS_SITE = 'gs://dartlang-docgen'
+
+def ExecuteCommand(cmd):
Emily Fortuna 2013/07/10 21:23:32 isn't this function defined in the utils file? If
janicejl 2013/07/11 00:02:08 No it is not in the utils file, it is in upload_sd
+ # Execute a command in a subprocess.
Emily Fortuna 2013/07/10 21:23:32 Doc comments for python are triple quotes """blah
janicejl 2013/07/11 00:02:08 Done.
+ print 'Executing: ' + ' '.join(cmd)
+ pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ shell=HAS_SHELL)
+ output = pipe.communicate()
+ if pipe.returncode != 0:
+ print 'Execution failed: ' + str(output)
+ return (pipe.returncode, output)
+
+def main(argv):
Emily Fortuna 2013/07/10 21:23:32 no need to pass argument if it's not used. def ma
janicejl 2013/07/11 00:02:08 Done.
+ # Execute Docgen.dart on the SDK.
+ ExecuteCommand([DART, 'docgen.dart', '--include-private', '--parse-sdk'])
+
+ # Use SVN Revision to get the revision number.
+ revision = utils.GetSVNRevision()
+ if revision is None:
+ sys.stderr.write('Unable to find revision. \n')
+ return 1
Emily Fortuna 2013/07/10 21:23:32 throw exception here instead? No point in continui
janicejl 2013/07/11 00:02:08 Done.
+
+ # Upload the all files in Docs into a folder based off Revision number on
+ # Cloud Storage.
+ ExecuteCommand([GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', '-r',
+ './docs/*', GS_SITE + '/' + revision + '/'])
+
+ # Update VERSION file in Cloud Storage.
+ with open('VERSION', 'w') as version_file:
+ version_file.write(revision);
+ ExecuteCommand([GSUTIL, '-m', 'cp', '-q', '-a', 'public-read', './VERSION',
+ GS_SITE + '/VERSION'])
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
Emily Fortuna 2013/07/10 21:23:32 it will automatically exit after calling main. Jus
janicejl 2013/07/11 00:02:08 Done.
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698