| 1 |
#!/usr/bin/python3 |
| 2 |
# Copyright 2021-2024 Simon McVittie |
| 3 |
# SPDX-License-Identifier: CC0-1.0 |
| 4 |
|
| 5 |
import base64 |
| 6 |
import sys |
| 7 |
from pathlib import Path |
| 8 |
from typing import Iterable |
| 9 |
|
| 10 |
|
| 11 |
def iter_output_dirs() -> Iterable[Path]: |
| 12 |
for librsvg in Path('target/release/build').glob('librsvg-*'): |
| 13 |
yield librsvg / 'out' |
| 14 |
|
| 15 |
yield Path('tests/output') |
| 16 |
|
| 17 |
|
| 18 |
if __name__ == '__main__': |
| 19 |
for d in iter_output_dirs(): |
| 20 |
for diff in d.glob('*-diff.png'): |
| 21 |
out = Path(str(diff)[:-len('-diff.png')] + '-out.png') |
| 22 |
|
| 23 |
for path in (out, diff): |
| 24 |
if path.exists(): |
| 25 |
print('') |
| 26 |
print('begin-base64 644 %s' % path) |
| 27 |
sys.stdout.flush() |
| 28 |
with open(path, 'rb') as reader: |
| 29 |
base64.encode(reader, sys.stdout.buffer) |
| 30 |
print('====') |
| 31 |
print('') |
| 32 |
|
| 33 |
print('') |