INNER CODE UNIT · Python
load_srcs
wolfSSL/wolfBoot · tools/sbom/sbom-driver.py:203
def load_srcs(srcs_file, skip_missing):
"""Read the source list; optionally drop paths that do not exist."""
kept, dropped = [], 0
with open(srcs_file, encoding="utf-8", errors="replace") as f:
for line in f:
s = line.strip()
if not s or s.startswith("#"):
continue
if skip_missing and not os.path.isfile(s):
print(f"WARNING: skipping missing source: {s}", file=sys.stderr)
dropped += 1
continue
kept.append(s)
if not kept:
sys.exit("ERROR: no source files remain for the SBOM.")
if dropped:
print(f" (--skip-missing dropped {dropped} file(s))", file=sys.stderr)
return kept