summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-05-29 15:38:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-29 15:38:17 +0000
commit85c69944bd40024dfb9a3d036e0dbabd6a457dbb (patch)
tree4ae7937e2f237afb17afe7cb87ee610a93a0fbac /tools
parentf251b0608900499104da834758b89930a13ab1cc (diff)
parent46eff27c32166f007132bfa5f4effc3c306b5f47 (diff)
downloadframeworks_base-85c69944bd40024dfb9a3d036e0dbabd6a457dbb.zip
frameworks_base-85c69944bd40024dfb9a3d036e0dbabd6a457dbb.tar.gz
frameworks_base-85c69944bd40024dfb9a3d036e0dbabd6a457dbb.tar.bz2
Merge "Recurse into directories to find fonts. [DO NOT MERGE]" into lmp-preview-dev
Diffstat (limited to 'tools')
-rwxr-xr-xtools/layoutlib/rename_font/build_font.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/layoutlib/rename_font/build_font.py b/tools/layoutlib/rename_font/build_font.py
index 7f01a13..aea3241 100755
--- a/tools/layoutlib/rename_font/build_font.py
+++ b/tools/layoutlib/rename_font/build_font.py
@@ -52,13 +52,17 @@ def main(argv):
os.chdir(cwd)
input_fonts = list()
for src_dir in src_dirs:
- for filename in os.listdir(src_dir):
- if os.path.isdir(os.path.join(src_dir, filename)):
- continue
- if not os.path.splitext(filename)[1].lower() == '.ttf':
- shutil.copy(os.path.join(src_dir, filename), dest_dir)
- continue
- input_fonts.append(os.path.join(src_dir, filename))
+ for dirname, dirnames, filenames in os.walk(src_dir):
+ for filename in filenames:
+ input_path = os.path.join(dirname, filename)
+ extension = os.path.splitext(filename)[1].lower()
+ if (extension == '.ttf'):
+ input_fonts.append(input_path)
+ elif (extension == '.xml'):
+ shutil.copy(input_path, dest_dir)
+ if '.git' in dirnames:
+ # don't go into any .git directories.
+ dirnames.remove('.git')
# Create as many threads as the number of CPUs
pool = Pool(processes=None)
pool.map(convert_font, input_fonts)