Merge pull request #4636 from bgruening/find_file

remove .git and .hg from recursive file search
This commit is contained in:
Marius van den Beek
2017-09-18 14:21:40 +02:00
committed by GitHub
+3
View File
@@ -22,6 +22,7 @@ TOOL_REGEX = re.compile(r"<tool\s")
YAML_EXTENSIONS = [".yaml", ".yml", ".json"]
CWL_EXTENSIONS = YAML_EXTENSIONS + [".cwl"]
EXCLUDE_WALK_DIRS = ['.hg', '.git', '.venv']
def load_exception_handler(path, exc_info):
@@ -264,6 +265,8 @@ def _find_files(directory, pattern='*'):
matches = []
for root, dirnames, filenames in os.walk(directory):
# exclude some directories (like .hg) from traversing
dirnames[:] = [dir for dir in dirnames if dir not in EXCLUDE_WALK_DIRS]
for filename in filenames:
full_path = os.path.join(root, filename)
if fnmatch.filter([full_path], pattern):