Fix recursive globbing in tools/format.py

And use third_party/depot_tools/gn.
This commit is contained in:
Ryan Dahl 2018-07-23 12:44:27 -04:00
parent 1de16af1f3
commit 7baf8a0fd1
2 changed files with 27 additions and 12 deletions

View file

@ -55,3 +55,16 @@ def touch(fname):
os.utime(fname, None)
else:
open(fname, 'a').close()
# Recursive search for files of certain extensions.
# (Recursive glob doesn't exist in python 2.7.)
def find_exts(directory, *extensions):
matches = []
for root, dirnames, filenames in os.walk(directory):
for filename in filenames:
for ext in extensions:
if filename.endswith(ext):
matches.append(os.path.join(root, filename))
break
return matches