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

Side by Side Diff: build/android/pylib/build_utils.py

Issue 12853002: Convert java library javac/jar to python (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « build/android/javac.py ('k') | build/android/strip_library_for_apk.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import fnmatch
5 import os 6 import os
7 import shlex
8 import shutil
6 9
7 10
8 def EnsureDirectoryExists(dir_path): 11 def MakeDirectory(dir_path):
9 try: 12 try:
10 os.makedirs(dir_path) 13 os.makedirs(dir_path)
11 except OSError: 14 except OSError:
12 pass 15 pass
13 16
14 17
18 def DeleteDirectory(dir_path):
19 if os.path.exists(dir_path):
20 shutil.rmtree(dir_path)
21
22
23 def Touch(path):
24 MakeDirectory(os.path.dirname(path))
25 with open(path, 'a'):
26 os.utime(path, None)
27
28
29 def FindInDirectory(directory, filter):
30 files = []
31 for root, dirnames, filenames in os.walk(directory):
32 matched_files = fnmatch.filter(filenames, filter)
33 files.extend((os.path.join(root, f) for f in matched_files))
34 return files
35
36
37 def FindInDirectories(directories, filter):
38 all_files = []
39 for directory in directories:
40 all_files.extend(FindInDirectory(directory, filter))
41 return all_files
42
43
44 def ParseGypList(gyp_string):
45 # The ninja generator doesn't support $ in strings, so use ## to
46 # represent $.
47 # TODO(cjhopman): Remove when
48 # https://code.google.com/p/gyp/issues/detail?id=327
49 # is addressed.
50 gyp_string = gyp_string.replace('##', '$')
51 return shlex.split(gyp_string)
52
53
OLDNEW
« no previous file with comments | « build/android/javac.py ('k') | build/android/strip_library_for_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698