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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/build_utils.py
diff --git a/build/android/pylib/build_utils.py b/build/android/pylib/build_utils.py
index 571e733eae6712993ac8289035326c15f1b52338..ea9acdc5440f70654c4bc0efc16960b7e4c57913 100644
--- a/build/android/pylib/build_utils.py
+++ b/build/android/pylib/build_utils.py
@@ -2,7 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import fnmatch
+import itertools
Yaron 2013/03/14 23:03:51 unused
cjhopman 2013/03/15 22:44:39 Done.
import os
+import shutil
def EnsureDirectoryExists(dir_path):
newt (away) 2013/03/15 03:25:04 MakeDirIfNotExists? the current name sounds asser
cjhopman 2013/03/15 22:44:39 Yeah, I didn't really like this name either... May
@@ -12,3 +15,41 @@ def EnsureDirectoryExists(dir_path):
pass
+def DeleteDirectory(dir_path):
+ if os.path.exists(dir_path):
+ shutil.rmtree(dir_path)
+
+
+def Touch(path):
+ EnsureDirectoryExists(os.path.dirname(path))
+ with open(path, 'a'):
+ os.utime(path, None)
+
+
+def FindInDirectory(directory, filter):
+ files = []
+ for root, dirnames, filenames in os.walk(directory):
+ files.extend(map(lambda f: os.path.join(root, f),
+ fnmatch.filter(filenames, filter)))
newt (away) 2013/03/15 03:25:04 list comprehension? rel_files = fnmatch.filte
cjhopman 2013/03/15 22:44:39 Done.
+ return files
+
+
+def FindInDirectories(directories, filter):
+ all_files = []
+ for directory in directories:
+ all_files.extend(FindInDirectory(directory, filter))
+ return all_files
+
+
+def ParseGypList(gyp_string):
newt (away) 2013/03/15 03:25:04 gyp_string = gyp_string.replace('##','$') return s
cjhopman 2013/03/15 22:44:39 Oh, shlex... much nicer. Done.
+ # With the ninja generator, some list members are in double quotes,
Yaron 2013/03/14 23:03:51 Why would we have these charcters in strings? "$"
cjhopman 2013/03/15 22:44:39 Precisely. I could find no way to escape/quote suc
+ # some aren't. For now, this only supports a limited format for lists
+ # (i.e. no spaces or double quotes in items).
+ gyp_list = gyp_string.split()
+ gyp_list = map(lambda s: s.replace('"', ''), gyp_list)
+ # The ninja generator doesn't support $ in strings, so use ## to
newt (away) 2013/03/15 03:25:04 is there any way we can change the generator to su
cjhopman 2013/03/15 22:44:39 I agree. Updated with a gyp bug tracking this.
+ # represent $.
+ gyp_list = map(lambda s: s.replace('##', '$'), gyp_list)
+ return gyp_list
+
+

Powered by Google App Engine
This is Rietveld 408576698