[glib] mkenums: Skip files not found



commit 69515e9f5c43046e673e8751e3703703cd41e540
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jul 17 10:24:32 2017 +0100

    mkenums: Skip files not found
    
    The old glib-mkenums was more forgiving, and simply ignored any files it
    could not find.
    
    We're going to print a warning, as in the future we may want to allow
    more strictness.

 gobject/glib-mkenums.in |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index cff0da3..c59d17c 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -348,7 +348,13 @@ if len(fhead) > 0:
 def process_file(curfilename):
     global entries, flags, seenbitshift, enum_prefix
     firstenum = True
-    curfile = open(curfilename)
+
+    try:
+        curfile = open(curfilename)
+    except FileNotFoundError:
+        sys.stderr.write('WARNING: No file "{}" found.'.format(curfilename))
+        return
+
     for line in curfile:
         # read lines until we have no open comments
         while re.search(r'/\*([^*]|\*(?!/))*$', line):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]