Check that manifest.dump() corresponds to the data. Mainly useful when debugging this script.
(manifest, filename)
| 602 | + 'removed from the stable ABI list or marked `abi_only`') |
| 603 | |
| 604 | def check_dump(manifest, filename): |
| 605 | """Check that manifest.dump() corresponds to the data. |
| 606 | |
| 607 | Mainly useful when debugging this script. |
| 608 | """ |
| 609 | dumped = tomllib.loads('\n'.join(manifest.dump())) |
| 610 | with filename.open('rb') as file: |
| 611 | from_file = tomllib.load(file) |
| 612 | if dumped != from_file: |
| 613 | print(f'Dump differs from loaded data!', file=sys.stderr) |
| 614 | diff = difflib.unified_diff( |
| 615 | pprint.pformat(dumped).splitlines(), |
| 616 | pprint.pformat(from_file).splitlines(), |
| 617 | '<dumped>', str(filename), |
| 618 | lineterm='', |
| 619 | ) |
| 620 | for line in diff: |
| 621 | print(line, file=sys.stderr) |
| 622 | return False |
| 623 | else: |
| 624 | return True |
| 625 | |
| 626 | def main(): |
| 627 | parser = argparse.ArgumentParser( |