Collect requirement files to include in SBOM requirements. Args: root (Path): The root directory of the repository. Returns: list[Path]: A list of Paths to requirement files to include in the SBOM.
(root: Path)
| 15 | |
| 16 | |
| 17 | def collect_files(root: Path) -> list[Path]: |
| 18 | """Collect requirement files to include in SBOM requirements. |
| 19 | |
| 20 | Args: |
| 21 | root (Path): The root directory of the repository. |
| 22 | |
| 23 | Returns: |
| 24 | list[Path]: A list of Paths to requirement files to include in the SBOM. |
| 25 | """ |
| 26 | files = [] |
| 27 | |
| 28 | # requirements.txt + all requirements/**/*.txt |
| 29 | for p in [root / "requirements.txt", *root.glob("requirements/**/*.txt")]: |
| 30 | if p.is_file() and p.name not in EXCLUDED_NAMES: |
| 31 | files.append(p) |
| 32 | |
| 33 | return files |
| 34 | |
| 35 | |
| 36 | def write_combined_req_files(root: Path, files: list[Path], outname: str) -> Path: |