MCPcopy Create free account
hub / github.com/numpy/numpy / general_source_directories_files

Function general_source_directories_files

numpy/distutils/misc_util.py:623–646  ·  view source on GitHub ↗

Return a directory name relative to top_path and files contained.

(top_path)

Source from the content-addressed store, hash-verified

621 yield os.path.join(dirpath, f)
622
623def general_source_directories_files(top_path):
624 """Return a directory name relative to top_path and
625 files contained.
626 """
627 pruned_directories = ['CVS', '.svn', 'build']
628 prune_file_pat = re.compile(r'(?:[~#]|\.py[co]|\.o)$')
629 for dirpath, dirnames, filenames in os.walk(top_path, topdown=True):
630 pruned = [ d for d in dirnames if d not in pruned_directories ]
631 dirnames[:] = pruned
632 for d in dirnames:
633 dpath = os.path.join(dirpath, d)
634 rpath = rel_path(dpath, top_path)
635 files = []
636 for f in os.listdir(dpath):
637 fn = os.path.join(dpath, f)
638 if os.path.isfile(fn) and not prune_file_pat.search(fn):
639 files.append(fn)
640 yield rpath, files
641 dpath = top_path
642 rpath = rel_path(dpath, top_path)
643 filenames = [os.path.join(dpath, f) for f in os.listdir(dpath) \
644 if not prune_file_pat.search(f)]
645 files = [f for f in filenames if os.path.isfile(f)]
646 yield rpath, files
647
648
649def get_ext_source_files(ext):

Callers 1

add_data_dirMethod · 0.85

Calls 4

rel_pathFunction · 0.85
listdirMethod · 0.80
compileMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected