collect_header_dirs#
- scikitplot.cython.collect_header_dirs(*paths, recursive=True, suffixes=None)[source]#
Collect unique directories that contain C/C++ header files.
This complements
collect_c_api_sourcesfor Scenario 5: given a source tree, automatically discover all directories containing.h/.hppheaders and return them as aninclude_dirslist.- Parameters:
- *pathsstr or os.PathLike
Root directories or explicit header file paths to search.
- recursivebool, default=True
If
True, subdirectories are searched recursively.- suffixesfrozenset[str] or None, default=None
Override the set of header suffixes. Default accepts
{".h", ".hpp", ".hxx", ".hh"}.
- Returns:
- list[pathlib.Path]
Deduplicated, sorted, absolute directory paths that contain at least one header file.
- Parameters:
- Return type:
Notes
Scenario 5d user note:
inc_dirs = collect_header_dirs("include/", "third_party/mylib/") result = compile_and_load(code, include_dirs=inc_dirs)
Examples
>>> import tempfile, pathlib >>> with tempfile.TemporaryDirectory() as td: ... p = pathlib.Path(td) ... (p / "mylib.h").write_text("#pragma once") ... dirs = collect_header_dirs(td) ... len(dirs) 1