mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #4636 from bgruening/find_file
remove .git and .hg from recursive file search
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user