summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-05-27 11:21:24 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-05-27 17:57:05 -0700
commit46eff27c32166f007132bfa5f4effc3c306b5f47 (patch)
tree49d3d8a6fccf170cf87c5968f5b69d3bdf3cf767 /tools
parentd23417ab5d1c623977d11b499c7f3bf2d5fb83b4 (diff)
downloadframeworks_base-46eff27c32166f007132bfa5f4effc3c306b5f47.zip
frameworks_base-46eff27c32166f007132bfa5f4effc3c306b5f47.tar.gz
frameworks_base-46eff27c32166f007132bfa5f4effc3c306b5f47.tar.bz2
Recurse into directories to find fonts. [DO NOT MERGE]
We now recurse into directories to find all fonts. This change is needed to prevent having to list all fonts in external/google-fonts individually. As a side effect, we now only copy xml files over. Change-Id: Ifdea3b8451878c2449ac7c5e17ef3d1b00d1b955 (cherry picked from commit c6364fd90de1600526d3431ce0740b6b856e48f0)
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)