Added
Link Here
|
1 |
--- tools/manager-file.py.orig 2014-05-07 14:16:47 UTC |
2 |
+++ tools/manager-file.py |
3 |
@@ -87,18 +87,18 @@ gflags = { |
4 |
|
5 |
def write_manager(f, manager, protos): |
6 |
# pointless backwards compat section |
7 |
- print >> f, '[ConnectionManager]' |
8 |
- print >> f, 'BusName=org.freedesktop.Telepathy.ConnectionManager.' + manager |
9 |
- print >> f, 'ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/' + manager |
10 |
+ print('[ConnectionManager]', file=f) |
11 |
+ print('BusName=org.freedesktop.Telepathy.ConnectionManager.' + manager, file=f) |
12 |
+ print('ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/' + manager, file=f) |
13 |
|
14 |
# protocols |
15 |
- for proto, params in protos.iteritems(): |
16 |
- print >> f |
17 |
- print >> f, '[Protocol %s]' % proto |
18 |
+ for proto, params in protos.items(): |
19 |
+ print(file=f) |
20 |
+ print('[Protocol %s]' % proto, file=f) |
21 |
|
22 |
defaults = {} |
23 |
|
24 |
- for param, info in params.iteritems(): |
25 |
+ for param, info in params.items(): |
26 |
dtype = info['dtype'] |
27 |
flags = info.get('flags', '').split() |
28 |
struct_field = info.get('struct_field', param.replace('-', '_')) |
29 |
@@ -115,15 +115,15 @@ def write_manager(f, manager, protos): |
30 |
else: |
31 |
flags = '' |
32 |
|
33 |
- print >> f, 'param-%s=%s%s' % (param, desktop_string(dtype), flags) |
34 |
+ print('param-%s=%s%s' % (param, desktop_string(dtype), flags), file=f) |
35 |
|
36 |
- for param, default in defaults.iteritems(): |
37 |
- print >> f, 'default-%s=%s' % (param, default) |
38 |
+ for param, default in defaults.items(): |
39 |
+ print('default-%s=%s' % (param, default), file=f) |
40 |
|
41 |
def write_c_params(f, manager, proto, struct, params): |
42 |
- print >> f, "static const TpCMParamSpec %s_%s_params[] = {" % (manager, proto) |
43 |
+ print("static const TpCMParamSpec %s_%s_params[] = {" % (manager, proto), file=f) |
44 |
|
45 |
- for param, info in params.iteritems(): |
46 |
+ for param, info in params.items(): |
47 |
dtype = info['dtype'] |
48 |
flags = info.get('flags', '').split() |
49 |
struct_field = info.get('struct_field', param.replace('-', '_')) |
50 |
@@ -146,7 +146,7 @@ def write_c_params(f, manager, proto, struct, params): |
51 |
else: |
52 |
struct_offset = 'G_STRUCT_OFFSET (%s, %s)' % (struct, struct_field) |
53 |
|
54 |
- print >> f, (''' { %s, %s, %s, |
55 |
+ print((''' { %s, %s, %s, |
56 |
%s, |
57 |
%s, /* default */ |
58 |
%s, /* struct offset */ |
59 |
@@ -154,14 +154,14 @@ def write_c_params(f, manager, proto, struct, params): |
60 |
%s, /* filter data */ |
61 |
%s /* setter data */ },''' % |
62 |
(c_string(param), c_string(dtype), gtypes[dtype], flags, |
63 |
- default, struct_offset, filter, filter_data, setter_data)) |
64 |
+ default, struct_offset, filter, filter_data, setter_data)), file=f) |
65 |
|
66 |
- print >> f, " { NULL }" |
67 |
- print >> f, "};" |
68 |
+ print(" { NULL }", file=f) |
69 |
+ print("};", file=f) |
70 |
|
71 |
if __name__ == '__main__': |
72 |
environment = {} |
73 |
- execfile(sys.argv[1], environment) |
74 |
+ exec(compile(open(sys.argv[1], "rb").read(), sys.argv[1], 'exec'), environment) |
75 |
|
76 |
filename = '%s/%s.manager' % (sys.argv[2], environment['MANAGER']) |
77 |
try: |