win32: make g_cond_wait_until() wait at least until end_time before returning with...
[glib.git] / gio / data-to-c.py
blobf226220eda1437266eb9bc89246af0953cf22093
1 #!/usr/bin/env python
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)