diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-08-03 13:15:04 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-08-03 13:19:47 +0100 |
commit | b09e4ca69b4dca6fd9d2e98a3722d765f86c837f (patch) | |
tree | 6b8044d29eaaf43066fce365eeb6e1f37111848c /build-aux/gen-resources.py | |
parent | 861a6dbea289d1ed98af1f66eb8024bc04464bd9 (diff) | |
download | gdk-pixbuf-b09e4ca69b4dca6fd9d2e98a3722d765f86c837f.tar.gz |
Move all aux scripts to their own directory
This makes it easier to find them and reference them.
Diffstat (limited to 'build-aux/gen-resources.py')
-rw-r--r-- | build-aux/gen-resources.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/build-aux/gen-resources.py b/build-aux/gen-resources.py new file mode 100644 index 000000000..4c182d9cf --- /dev/null +++ b/build-aux/gen-resources.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Ancillary wrapper around glib-compile-resources that sets up a +# modified environment in order to use the tools that we just +# built instead of the system ones + +import argparse +import os +import subprocess +import sys + +argparser = argparse.ArgumentParser(description='Compile resources') +argparser.add_argument('--pixdata', metavar='PATH', help='Path to gdk-pixbuf-pixdata') +argparser.add_argument('--loaders', metavar='PATH', help='Path to the loaders.cache file') +argparser.add_argument('--sourcedir', metavar='PATH', help='Path to the source directory') +argparser.add_argument('resource', help='GResource XML file') +argparser.add_argument('output', help='Output file') + +group = argparser.add_mutually_exclusive_group() +group.add_argument('--header', help='Generate header file', action='store_true') +group.add_argument('--source', help='Generate source file', action='store_true') + +args = argparser.parse_args() + +cmd = ['glib-compile-resources'] +if args.header: + cmd += ['--generate-header'] +else: + cmd += ['--generate-source'] + +cmd += ['--sourcedir', args.sourcedir] +cmd += [args.resource] +cmd += ['--target', args.output] + +newenv = os.environ.copy() +newenv['GDK_PIXBUF_PIXDATA'] = args.pixdata +newenv['GDK_PIXBUF_MODULE_FILE'] = args.loaders + +out, err = subprocess.Popen(cmd, env=newenv).communicate() +if out is None: + sys.exit(0) +else: + print(out) + sys.exit(1) |