Skip to content

Commit

Permalink
remove .git and .hg from recursive file search
Browse files Browse the repository at this point in the history
  • Loading branch information
bgruening committed Sep 16, 2017
1 parent 52436aa commit 5f635bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/galaxy/tools/loader_directory.py
Expand Up @@ -22,6 +22,7 @@

YAML_EXTENSIONS = [".yaml", ".yml", ".json"]
CWL_EXTENSIONS = YAML_EXTENSIONS + [".cwl"]
EXCLUDE_WALK_DIRS = ['.hg', '.git']


def load_exception_handler(path, exc_info):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 5f635bd

Please sign in to comment.