MCPcopy Index your code
hub / github.com/idank/explainshell / postprocess

Function postprocess

tools/postprocess_ubuntu_archive.py:140–160  ·  view source on GitHub ↗

Copy and restructure manpages from *src_dir* to *dst_dir*. Only sections listed in ``SECTIONS_TO_KEEP`` are copied. Section directories are renamed (e.g. ``man1`` → ``1``). Valid symlinks are preserved with their targets rewritten when necessary. Broken symlinks are removed.

(src_dir: Path, dst_dir: Path, *, dry_run: bool = False)

Source from the content-addressed store, hash-verified

138
139
140def postprocess(src_dir: Path, dst_dir: Path, *, dry_run: bool = False) -> Stats:
141 """Copy and restructure manpages from *src_dir* to *dst_dir*.
142
143 Only sections listed in ``SECTIONS_TO_KEEP`` are copied. Section
144 directories are renamed (e.g. ``man1`` → ``1``). Valid symlinks are
145 preserved with their targets rewritten when necessary. Broken
146 symlinks are removed.
147 """
148 stats = Stats()
149
150 for src_name, dst_name in SECTIONS_TO_KEEP.items():
151 src_section = src_dir / src_name
152 if not src_section.is_dir():
153 logger.warning("section %s not found in %s, skipping", src_name, src_dir)
154 continue
155
156 dst_section = dst_dir / dst_name
157 logger.info("processing section %s -> %s", src_name, dst_name)
158 process_section(src_section, dst_section, src_dir, stats, dry_run=dry_run)
159
160 return stats
161
162
163def main() -> None:

Calls 2

StatsClass · 0.85
process_sectionFunction · 0.85