util.py 632 B

1234567891011121314151617181920212223
  1. import os
  2. def get_tor_c_files(tor_topdir, exclude_dirs):
  3. """
  4. Return a list with the .c filenames we want to get metrics of.
  5. """
  6. files_list = []
  7. for root, directories, filenames in os.walk(tor_topdir):
  8. for filename in filenames:
  9. # We only care about .c files
  10. if not filename.endswith(".c"):
  11. continue
  12. # Exclude the excluded paths
  13. full_path = os.path.join(root,filename)
  14. if any(exclude_dir in full_path for exclude_dir in exclude_dirs):
  15. continue
  16. files_list.append(full_path)
  17. return files_list