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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « mojo/runner/android/main.cc ('k') | mojo/tools/mopy/android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Generates the assets_list file from a directory."""
8
9 import argparse
10 import os
11 import sys
12
13 def main():
14 parser = argparse.ArgumentParser(usage="--dir <directory>")
15
16 parser.add_argument('--dir', help='Directory read files from.', required=True)
17
18 options, _ = parser.parse_known_args()
19
20 if not os.path.exists(options.dir) or not os.path.isdir(options.dir):
21 print 'Directory does not exist, or path is not a directory', options.dir
22 return -1
23
24 root_dir = os.path.abspath(options.dir)
25 all_files = []
26 for current_root, _, files in os.walk(options.dir):
27 current_root_absolute = os.path.abspath(current_root)
28 if len(current_root_absolute) < len(root_dir):
29 print 'unexpected directory', current_root_absolute
30 return -1
31 rel_root = current_root_absolute[len(root_dir):]
32 if len(rel_root) and rel_root.startswith(os.sep):
33 rel_root = rel_root[len(os.sep):]
34 if len(rel_root) and not rel_root.endswith(os.sep):
35 rel_root += os.sep
36 all_files.extend([rel_root + f for f in files])
37
38 with open(os.path.join(options.dir, 'assets_list'), 'w') as f:
39 for a_file in all_files:
40 f.write(a_file + '\n')
41
42 return 0
43
44 if __name__ == '__main__':
45 sys.exit(main())
46
OLDNEW
« 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