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

Side by Side Diff: build/android/gyp/delete_files.py

Issue 200753002: [Android] Workaround of an android platform bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ChildProcessService needs to use the hack Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/android/library_loader/library_loader_hooks.cc ('k') | build/common.gypi » ('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 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Delete files in directories matching a pattern.
7 """
8
9 import glob
10 import optparse
11 import os
12 import sys
13
14 def main():
15 parser = optparse.OptionParser()
16 parser.add_option(
17 '--pattern',
18 help='Pattern for matching Files to delete.')
19 parser.add_option(
20 '--keep',
21 help='Files to keep even if they matches the pattern.')
22
23 options, args = parser.parse_args()
24
25 if not options.pattern or not args:
26 print 'No --pattern or target directories given'
27 return
28
29 for target_dir in args:
30 target_pattern = os.path.join(target_dir, options.pattern)
31 matching_files = glob.glob(target_pattern)
32
33 keep_pattern = os.path.join(target_dir, options.keep)
34 files_to_keep = glob.glob(keep_pattern)
35
36 for target_file in matching_files:
37 if target_file in files_to_keep:
38 continue
39
40 if os.path.isfile(target_file):
41 os.remove(target_file)
42
43 if __name__ == '__main__':
44 sys.exit(main())
45
OLDNEW
« no previous file with comments | « base/android/library_loader/library_loader_hooks.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698