gio: Annotate GDBusObjectManagerClient signal appropriately
[glib.git] / gio / data-to-c.py
blob7a8d8a865cff53f618a35466cf6ab52e39d90440
1 #!/usr/bin/env python3
3 import sys
5 if len(sys.argv) < 4:
6 print('Usage: {0} <filename> <variable> <output>')
8 with open(sys.argv[1], 'rb') as f:
9 in_data = f.read().decode('utf-8', 'backslashreplace')
10 b = [r'\x{:02x}'.format(ord(c)) for c in in_data]
12 out_data = "const char {0}[] = \"".format(sys.argv[2])
13 out_data += "".join(b) + "\";"
15 with open(sys.argv[3], 'w') as f:
16 f.write(out_data)