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)
| 138 | |
| 139 | |
| 140 | def 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 | |
| 163 | def main() -> None: |