2017-05-24 06:55:37 +02:00
|
|
|
# Simple Python script to generate the full .schema.xml files
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
from replace import replace_multi
|
|
|
|
|
|
|
|
def main(argv):
|
2017-05-24 07:16:55 +02:00
|
|
|
srcroot = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
|
2017-05-24 06:55:37 +02:00
|
|
|
parser = argparse.ArgumentParser(description='Generate Utility Scripts')
|
|
|
|
parser.add_argument('-t', '--type', help='Script Type (glib-mkenums or gdbus-codegen)', required=True)
|
|
|
|
parser.add_argument('--version', help='Package Version', required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
replace_items = {'@PYTHON@': 'python',
|
|
|
|
'@PERL_PATH@': 'perl',
|
2017-07-12 05:45:34 +02:00
|
|
|
'@GLIB_VERSION@': args.version,
|
|
|
|
'@VERSION@': args.version}
|
2017-05-24 06:55:37 +02:00
|
|
|
|
|
|
|
if args.type == 'glib-mkenums':
|
2017-05-24 07:16:55 +02:00
|
|
|
replace_multi(srcroot + '/gobject/glib-mkenums.in',
|
|
|
|
srcroot + '/gobject/glib-mkenums',
|
2017-05-24 06:55:37 +02:00
|
|
|
replace_items)
|
2017-07-12 05:45:34 +02:00
|
|
|
elif args.type == 'glib-genmarshal':
|
|
|
|
replace_multi(srcroot + '/gobject/glib-genmarshal.in',
|
|
|
|
srcroot + '/gobject/glib-genmarshal',
|
|
|
|
replace_items)
|
2017-05-24 06:55:37 +02:00
|
|
|
elif args.type == 'gdbus-codegen':
|
2017-05-24 07:16:55 +02:00
|
|
|
replace_multi(srcroot + '/gio/gdbus-2.0/codegen/gdbus-codegen.in',
|
|
|
|
srcroot + '/gio/gdbus-2.0/codegen/gdbus-codegen',
|
2017-05-24 06:55:37 +02:00
|
|
|
replace_items)
|
|
|
|
|
|
|
|
else:
|
|
|
|
raise ValueError('Type must be glib-mkenums or gdbus-codegen')
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main(sys.argv))
|