Merge branch 'fix-glib-genmarshal-empty-output' into 'master'

glib-genmarshal: close output file

Closes #2341

See merge request GNOME/glib!1978
This commit is contained in:
Sebastian Dröge 2021-03-09 12:47:22 +00:00
commit 40573a8b8b

View File

@ -864,7 +864,7 @@ def generate_marshallers_body(outfile, retval, params,
outfile.write('\n\n') outfile.write('\n\n')
if __name__ == '__main__': def parse_args():
arg_parser = argparse.ArgumentParser(description='Generate signal marshallers for GObject') arg_parser = argparse.ArgumentParser(description='Generate signal marshallers for GObject')
arg_parser.add_argument('--prefix', metavar='STRING', arg_parser.add_argument('--prefix', metavar='STRING',
default='g_cclosure_user_marshal', default='g_cclosure_user_marshal',
@ -945,6 +945,10 @@ if __name__ == '__main__':
print(VERSION_STR) print(VERSION_STR)
sys.exit(0) sys.exit(0)
return args
def generate(args):
# Backward compatibility hack; some projects use both arguments to # Backward compatibility hack; some projects use both arguments to
# generate the marshallers prototype in the C source, even though # generate the marshallers prototype in the C source, even though
# it's not really a supported use case. We keep this behaviour by # it's not really a supported use case. We keep this behaviour by
@ -1067,3 +1071,10 @@ if __name__ == '__main__':
if args.header: if args.header:
generate_header_postamble(args.output, prefix=args.prefix, use_pragma=args.pragma_once) generate_header_postamble(args.output, prefix=args.prefix, use_pragma=args.pragma_once)
if __name__ == '__main__':
args = parse_args()
with args.output:
generate(args)