Skip to content
Snippets Groups Projects
Commit 7b45efa3 authored by Valentin Perrelle's avatar Valentin Perrelle
Browse files

Merge branch 'fix/andre/analysis-scripts-find-fun' into 'stable/chromium'

[analysis-scripts] avoid following symbolic links for better performance

See merge request frama-c/frama-c!3329
parents 4b8e893f 8c5326bc
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
# for a given function name, via heuristic syntactic matching. # for a given function name, via heuristic syntactic matching.
import argparse import argparse
import sys import function_finder
import os import os
import re import re
import glob import sys
import function_finder from pathlib import Path
MIN_PYTHON = (3, 5) # for glob(recursive) MIN_PYTHON = (3, 5) # for glob(recursive)
if sys.version_info < MIN_PYTHON: if sys.version_info < MIN_PYTHON:
...@@ -65,9 +65,12 @@ if not dirs: ...@@ -65,9 +65,12 @@ if not dirs:
else: else:
dirs = set(sys.argv[2:]) dirs = set(sys.argv[2:])
files = [] files = set()
for d in dirs: for d in dirs:
files += glob.glob(d + "/**/*.[ich]", recursive=True) # The usage of Path.glob here prevents symbolic links from being
# followed, which is desirable in some situations. However, if you
# need them, try using glob.glob instead.
files.update(Path(d).glob("**/*.[ich]"))
print("Looking for '%s' inside %d file(s)..." % (fname, len(files))) print("Looking for '%s' inside %d file(s)..." % (fname, len(files)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment