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

Unified Diff: mojo/tools/generate_mojo_shell_assets_list.py

Issue 1130763004: Gets mandoline working on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 5 years, 7 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/runner/android/main.cc ('k') | mojo/tools/mopy/android.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/generate_mojo_shell_assets_list.py
diff --git a/mojo/tools/generate_mojo_shell_assets_list.py b/mojo/tools/generate_mojo_shell_assets_list.py
new file mode 100755
index 0000000000000000000000000000000000000000..1a55af43e6f3f1bced184706bda9830983d35689
--- /dev/null
+++ b/mojo/tools/generate_mojo_shell_assets_list.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Generates the assets_list file from a directory."""
+
+import argparse
+import os
+import sys
+
+def main():
+ parser = argparse.ArgumentParser(usage="--dir <directory>")
+
+ parser.add_argument('--dir', help='Directory read files from.', required=True)
+
+ options, _ = parser.parse_known_args()
+
+ if not os.path.exists(options.dir) or not os.path.isdir(options.dir):
+ print 'Directory does not exist, or path is not a directory', options.dir
+ return -1
+
+ root_dir = os.path.abspath(options.dir)
+ all_files = []
+ for current_root, _, files in os.walk(options.dir):
+ current_root_absolute = os.path.abspath(current_root)
+ if len(current_root_absolute) < len(root_dir):
+ print 'unexpected directory', current_root_absolute
+ return -1
+ rel_root = current_root_absolute[len(root_dir):]
+ if len(rel_root) and rel_root.startswith(os.sep):
+ rel_root = rel_root[len(os.sep):]
+ if len(rel_root) and not rel_root.endswith(os.sep):
+ rel_root += os.sep
+ all_files.extend([rel_root + f for f in files])
+
+ with open(os.path.join(options.dir, 'assets_list'), 'w') as f:
+ for a_file in all_files:
+ f.write(a_file + '\n')
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
+
« no previous file with comments | « mojo/runner/android/main.cc ('k') | mojo/tools/mopy/android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698