Commit d5da329c by Geoff Lang

Improve the enumerate_files.py script.

Cleaned up the agument parsing and added support for excluding files/folders. BUG=angle:552 Change-Id: I6dcf965f9b92ce4aa1c0b64bd4f9a0420883bcf6 Reviewed-on: https://chromium-review.googlesource.com/185204Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 1106aeb2
......@@ -2,25 +2,52 @@ import fnmatch
import os
import sys
rootdirs = [ ]
filetypes = [ ]
dirs = [ ]
types = [ ]
excludes = [ ]
foundTypesArg = False
# Default to accepting a list of directories first
curArray = dirs
# Iterate over the arguments and add them to the arrays
for i in range(1, len(sys.argv)):
arg = sys.argv[i]
if arg == "-dirs":
curArray = dirs
continue
if arg == "-types":
foundTypesArg = True
curArray = types
continue
if foundTypesArg:
filetypes.append(arg)
else:
rootdirs.append(arg)
if arg == "-excludes":
curArray = excludes
continue
for rootdir in rootdirs:
curArray.append(arg)
# If no directories were specified, use the current directory
if len(dirs) == 0:
dirs.append(".")
# If no types were specified, accept all types
if len(types) == 0:
types.append("*")
# Walk the directories listed and compare with type and exclude lists
for rootdir in dirs:
for root, dirnames, filenames in os.walk(rootdir):
for file in filenames:
for type in filetypes:
if fnmatch.fnmatchcase(file, type):
print os.path.join(root, file).replace("\\", "/")
break
fullPath = os.path.join(root, file).replace("\\", "/")
for type in types:
if fnmatch.fnmatchcase(fullPath, type):
excluded = False
for exclude in excludes:
if fnmatch.fnmatchcase(fullPath, exclude):
excluded = True
break
if not excluded:
print fullPath
break
......@@ -27,7 +27,12 @@
[
'ANGLE_TRANSLATOR_IMPLEMENTATION',
],
'sources': [ '<!@(python <(angle_build_scripts_path)/enumerate_files.py compiler/translator third_party/compiler common ../include -types *.cpp *.h *.y *.l )', ],
'sources':
[
'<!@(python <(angle_build_scripts_path)/enumerate_files.py \
-dirs compiler/translator third_party/compiler common ../include \
-types *.cpp *.h *.y *.l)',
],
'conditions':
[
['OS=="win"',
......
......@@ -19,7 +19,12 @@
'../include',
'libGLESv2',
],
'sources': [ '<!@(python <(angle_build_scripts_path)/enumerate_files.py common libEGL ../include -types *.cpp *.h *.def libEGL.rc)' ],
'sources':
[
'<!@(python <(angle_build_scripts_path)/enumerate_files.py \
-dirs common libEGL ../include \
-types *.cpp *.h *.def *.rc)',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'msvs_settings':
......
......@@ -28,7 +28,12 @@
'../include',
'libGLESv2',
],
'sources': [ '<!@(python <(angle_build_scripts_path)/enumerate_files.py common libGLESv2 third_party/murmurhash ../include -types *.cpp *.h *.hlsl *.vs *.ps *.bat *.def libGLESv2.rc)', ],
'sources':
[
'<!@(python <(angle_build_scripts_path)/enumerate_files.py \
-dirs common libGLESv2 third_party/murmurhash ../include \
-types *.cpp *.h *.hlsl *.vs *.ps *.bat *.def *.rc)',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'msvs_settings':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment