[libadwaita/msvc: 19/20] gen-public-types.py: Print output directly




commit e6e263f0def266c55e201d1fa0d35981e37b1973
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jan 18 12:36:48 2022 +0800

    gen-public-types.py: Print output directly
    
    Don't store the contents of the generated source output in a list, but print
    things out directly.

 src/gen-public-types.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/gen-public-types.py b/src/gen-public-types.py
index 755df48f..99778986 100644
--- a/src/gen-public-types.py
+++ b/src/gen-public-types.py
@@ -6,11 +6,11 @@ import sys
 
 def main(argv):
     ensure_types = []
-    result = ['/* This file was generated by gen-plublic-types.py, do not edit it. */', '']
+    print('/* This file was generated by gen-plublic-types.py, do not edit it. */\n')
 
     # Run through the headers fed in to #include them and extract the ADW_TYPE_* macros
     for header in argv[1:]:
-        result.append('#include "%s"' % os.path.basename(header))
+        print('#include "%s"' % os.path.basename(header))
         with open(header, 'r') as file:
             for line in file:
                 match = re.search(r'#define {1,}(ADW_TYPE_[A-Z0-9_]{1,}) {1,}.*', line)
@@ -19,16 +19,14 @@ def main(argv):
 
     ensure_types.sort()
 
-    result.append('#include "adw-main-private.h"\n')
-    result.append('void')
-    result.append('adw_init_public_types (void)')
-    result.append('{')
+    print('#include "adw-main-private.h"\n')
+    print('void')
+    print('adw_init_public_types (void)')
+    print('{')
 
     for gtype in ensure_types:
-        result.append('  g_type_ensure (%s);' % gtype)
+        print('  g_type_ensure (%s);' % gtype)
 
-    result.append('}')
-    for l in result:
-        print(l)
+    print('}')
     
 main(sys.argv)


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