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

Unified Diff: mojo/tools/upload_shell_binary.py

Issue 874243002: Support uploading Mojo Shell on Android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « mojo/tools/mopy/paths.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/upload_shell_binary.py
diff --git a/mojo/tools/upload_shell_binary.py b/mojo/tools/upload_shell_binary.py
index 83c8847db457ac8f7932b77425541f21d69fbbc3..52beae43b047837ff1db33ffe574b2678db7c84a 100755
--- a/mojo/tools/upload_shell_binary.py
+++ b/mojo/tools/upload_shell_binary.py
@@ -15,27 +15,37 @@ from mopy.config import Config
from mopy.paths import Paths
from mopy.version import Version
-paths = Paths(Config(target_os=Config.OS_LINUX, is_debug=False))
+def upload(dry_run, verbose, android):
qsr 2015/01/26 15:57:47 Should you take a config instead of just android?
blundell 2015/01/26 16:22:43 Done.
+ target_os = Config.OS_LINUX
+ if android:
+ target_os = Config.OS_ANDROID
+ paths = Paths(Config(target_os=target_os, is_debug=False))
-sys.path.insert(0, os.path.join(paths.src_root, "tools"))
-# pylint: disable=F0401
-import find_depot_tools
+ sys.path.insert(0, os.path.join(paths.src_root, "tools"))
+ # pylint: disable=F0401
+ import find_depot_tools
-depot_tools_path = find_depot_tools.add_depot_tools_to_path()
-gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil")
+ depot_tools_path = find_depot_tools.add_depot_tools_to_path()
+ gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil")
-def upload(dry_run, verbose):
- dest = "gs://mojo/shell/" + Version().version + "/linux-x64.zip"
+ zipfile_name = "linux-x64"
+ if android:
+ zipfile_name = "android-arm32"
qsr 2015/01/26 15:57:47 The usual name of android is just arm (see our gn
blundell 2015/01/26 16:22:43 Done.
+ dest = "gs://mojo/shell/" + Version().version + "/" + zipfile_name + ".zip"
with tempfile.NamedTemporaryFile() as zip_file:
with zipfile.ZipFile(zip_file, 'w') as z:
- with open(paths.mojo_shell_path) as shell_binary:
- zipinfo = zipfile.ZipInfo("mojo_shell")
+ shell_path = paths.mojo_shell_path
+ if android:
+ shell_path = paths.target_mojo_shell_path
qsr 2015/01/26 15:57:47 Can you try to aggregate those by always setting s
blundell 2015/01/26 16:22:43 Done.
+ with open(shell_path) as shell_binary:
+ shell_filename = os.path.basename(shell_path)
+ zipinfo = zipfile.ZipInfo(shell_filename)
zipinfo.external_attr = 0777 << 16L
zipinfo.compress_type = zipfile.ZIP_DEFLATED
- zipinfo.date_time = time.gmtime(os.path.getmtime(paths.mojo_shell_path))
+ zipinfo.date_time = time.gmtime(os.path.getmtime(shell_path))
if verbose:
- print "zipping %s" % paths.mojo_shell_path
+ print "zipping %s" % shell_path
z.writestr(zipinfo, shell_binary.read())
if dry_run:
print str([gsutil_exe, "cp", zip_file.name, dest])
@@ -49,8 +59,10 @@ def main():
"upload", action="store_true")
parser.add_argument("-v", "--verbose", help="Verbose mode",
action="store_true")
+ parser.add_argument("--android", help="Upload the shell for Android",
+ action="store_true")
qsr 2015/01/26 15:57:47 Should you instead pass a build_dir? Then using mo
blundell 2015/01/26 16:22:43 Done.
args = parser.parse_args()
- upload(args.dry_run, args.verbose)
+ upload(args.dry_run, args.verbose, args.android)
return 0
if __name__ == "__main__":
« no previous file with comments | « mojo/tools/mopy/paths.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698