#!/usr/bin/env python3 # # Generate gdk.gresources.xml # # Usage: gen-gdk-gresources-xml SRCDIR_GDK [OUTPUT-FILE] import os, sys srcdir = sys.argv[1] xml = ''' ''' def get_files(subdir,extension): return sorted(filter(lambda x: x.endswith((extension)), os.listdir(os.path.join(srcdir,subdir)))) for f in get_files('resources/glsl', '.glsl'): xml += ' resources/glsl/{0}\n'.format(f) xml += ''' ''' if len(sys.argv) > 2: outfile = sys.argv[2] f = open(outfile, 'w', encoding='utf-8') f.write(xml) f.close() else: print(xml)