[glib] mkenums: Keep compatibility with Python 2.x
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] mkenums: Keep compatibility with Python 2.x
- Date: Mon, 17 Jul 2017 15:31:33 +0000 (UTC)
commit 2219cfb92daf9b9413de35a1089efa3a1dff7602
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Jul 17 16:29:40 2017 +0100
mkenums: Keep compatibility with Python 2.x
Since every other tool in GLib is allowed to be used with Python 2.x,
glib-mkenums should follow suit.
gobject/glib-mkenums.in | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index 8b8dac8..3b9a30c 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -115,7 +115,13 @@ def parse_entries(file, file_name):
global entries, enumindex, enumname, seenbitshift, flags
looking_for_name = False
- for line in file:
+ while True:
+ line = file.readline()
+ if not line:
+ break
+
+ line = line.strip()
+
# read lines until we have no open comments
while re.search(r'/\*([^*]|\*(?!/))*$', line):
line += file.readline()
@@ -396,7 +402,13 @@ def process_file(curfilename):
print_warning('No file "{}" found.'.format(curfilename))
return
- for line in curfile:
+ while True:
+ line = curfile.readline()
+ if not line:
+ break
+
+ line = line.strip()
+
# read lines until we have no open comments
while re.search(r'/\*([^*]|\*(?!/))*$', line):
line += curfile.readline()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]