| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
from argparse import ArgumentParser |
| 4 |
from pathlib import Path |
| 5 |
import os |
| 6 |
import subprocess |
| 7 |
import sys |
| 8 |
|
| 9 |
argparse = ArgumentParser('Deploy loaders.cache') |
| 10 |
|
| 11 |
argparse.add_argument('--gdk-pixbuf-moduledir', type=Path) |
| 12 |
argparse.add_argument('gdk_pixbuf_queryloaders', type=Path) |
| 13 |
argparse.add_argument('gdk_pixbuf_cache_file', type=Path) |
| 14 |
argparse.add_argument('--show-cross-message', action='store_true') |
| 15 |
|
| 16 |
if __name__ == '__main__': |
| 17 |
args = argparse.parse_args() |
| 18 |
|
| 19 |
cache_file: Path = args.gdk_pixbuf_cache_file |
| 20 |
|
| 21 |
if args.show_cross_message or os.environ.get("DESTDIR"): |
| 22 |
print('*** Note: Please run gdk-pixbuf-queryloaders manually ' + |
| 23 |
'against the newly-built gdkpixbuf-svg loader', file=sys.stderr) |
| 24 |
else: |
| 25 |
env = os.environ.copy() |
| 26 |
env['GDK_PIXBUF_MODULEDIR'] = Path(args.gdk_pixbuf_moduledir).as_posix() |
| 27 |
with cache_file.open('w', encoding='utf-8') as f: |
| 28 |
subprocess.run( |
| 29 |
[Path(args.gdk_pixbuf_queryloaders).as_posix()], |
| 30 |
env=env, |
| 31 |
stdout=f, |
| 32 |
check=True |
| 33 |
) |
| 34 |
|