|
|
d1681e |
From a7570af0bc6dc53044dce2cace9a65e96c571da6 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Aravinda VK <avishwan@redhat.com>
|
|
|
3604df |
Date: Mon, 19 Sep 2016 16:59:30 +0530
|
|
|
d1681e |
Subject: [PATCH 20/74] eventsapi: Fix eventtypes.h header generation with
|
|
|
d1681e |
Python 2.4
|
|
|
3604df |
|
|
|
3604df |
eventskeygen.py file generates eventtypes.h and eventtypes.py files
|
|
|
3604df |
during build. If Python version is old(Version 2.4), then Gluster
|
|
|
3604df |
Client build will fail. eventskeygen.py uses "with" statement to
|
|
|
3604df |
open file, which is introduced in Python 2.5
|
|
|
3604df |
|
|
|
3604df |
Label: DOWNSTREAM ONLY
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I995e102fad0c7bc66e840b1ab9d53ed564266253
|
|
|
3604df |
Signed-off-by: Aravinda VK <avishwan@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/85060
|
|
|
3604df |
Reviewed-by: Milind Changire <mchangir@redhat.com>
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
d1681e |
events/eventskeygen.py | 47 +++++++++++++++++++++++++----------------------
|
|
|
d1681e |
1 file changed, 25 insertions(+), 22 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
|
|
|
d1681e |
index 23dfb47..a9c5573 100644
|
|
|
3604df |
--- a/events/eventskeygen.py
|
|
|
3604df |
+++ b/events/eventskeygen.py
|
|
|
d1681e |
@@ -207,33 +207,36 @@ ERRORS = (
|
|
|
3604df |
|
|
|
3604df |
if gen_header_type == "C_HEADER":
|
|
|
3604df |
# Generate eventtypes.h
|
|
|
3604df |
- with open(eventtypes_h, "w") as f:
|
|
|
3604df |
- f.write("#ifndef __EVENTTYPES_H__\n")
|
|
|
3604df |
- f.write("#define __EVENTTYPES_H__\n\n")
|
|
|
3604df |
- f.write("typedef enum {\n")
|
|
|
3604df |
- for k in ERRORS:
|
|
|
3604df |
- f.write(" {0},\n".format(k))
|
|
|
3604df |
- f.write("} event_errors_t;\n")
|
|
|
3604df |
+ f = open(eventtypes_h, "w")
|
|
|
3604df |
+ f.write("#ifndef __EVENTTYPES_H__\n")
|
|
|
3604df |
+ f.write("#define __EVENTTYPES_H__\n\n")
|
|
|
3604df |
+ f.write("typedef enum {\n")
|
|
|
3604df |
+ for k in ERRORS:
|
|
|
3604df |
+ f.write(" %s,\n" % k)
|
|
|
3604df |
+ f.write("} event_errors_t;\n")
|
|
|
3604df |
|
|
|
3604df |
- f.write("\n")
|
|
|
3604df |
+ f.write("\n")
|
|
|
3604df |
|
|
|
3604df |
- f.write("typedef enum {\n")
|
|
|
3604df |
- for k in keys:
|
|
|
3604df |
- f.write(" {0},\n".format(k))
|
|
|
3604df |
+ f.write("typedef enum {\n")
|
|
|
3604df |
+ for k in keys:
|
|
|
3604df |
+ f.write(" %s,\n" % k)
|
|
|
3604df |
|
|
|
3604df |
- f.write(" {0}\n".format(LAST_EVENT))
|
|
|
3604df |
- f.write("} eventtypes_t;\n")
|
|
|
3604df |
- f.write("\n#endif /* __EVENTTYPES_H__ */\n")
|
|
|
3604df |
+ f.write(" %s\n" % LAST_EVENT)
|
|
|
3604df |
+ f.write("} eventtypes_t;\n")
|
|
|
3604df |
+ f.write("\n#endif /* __EVENTTYPES_H__ */\n")
|
|
|
3604df |
+ f.close()
|
|
|
3604df |
|
|
|
3604df |
if gen_header_type == "PY_HEADER":
|
|
|
3604df |
# Generate eventtypes.py
|
|
|
3604df |
- with open(eventtypes_py, "w") as f:
|
|
|
3604df |
- f.write("# -*- coding: utf-8 -*-\n")
|
|
|
3604df |
- f.write("all_events = [\n")
|
|
|
3604df |
- for ev in keys:
|
|
|
3604df |
- f.write(' "{0}",\n'.format(ev))
|
|
|
3604df |
+ f = open(eventtypes_py, "w")
|
|
|
3604df |
+ f.write("# -*- coding: utf-8 -*-\n")
|
|
|
3604df |
+ f.write("all_events = [\n")
|
|
|
3604df |
+ for ev in keys:
|
|
|
3604df |
+ f.write(' "%s",\n' % ev)
|
|
|
3604df |
|
|
|
3604df |
- f.write("]\n\n")
|
|
|
3604df |
+ f.write("]\n\n")
|
|
|
3604df |
|
|
|
3604df |
- for idx, ev in enumerate(keys):
|
|
|
3604df |
- f.write("{0} = {1}\n".format(ev.replace("EVENT_", ""), idx))
|
|
|
3604df |
+ for idx, ev in enumerate(keys):
|
|
|
3604df |
+ f.write("%s = %s\n" % (ev.replace("EVENT_", ""), idx))
|
|
|
3604df |
+
|
|
|
3604df |
+ f.close()
|
|
|
3604df |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
3604df |
|