[glib] gdbus-codegen: Fix issue with docbook generation



commit 93042e00529107c0d89e530401b9daef65a03de0
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Jan 24 16:25:09 2018 +0100

    gdbus-codegen: Fix issue with docbook generation
    
    In cases where gdbus-codegen is used only for docbook generation,
    the execution stops with the following error message:
    
      `Using --header or --body requires --output`
    
    This is because it was assumed that, in addition to the docbook
    generation, the header or source code were always generated.
    
    This patch fixes this, and the header or source code generation
    is not mandatory, so the docbook can be generated separately.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791015

 gio/gdbus-2.0/codegen/codegen_main.py |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen_main.py b/gio/gdbus-2.0/codegen/codegen_main.py
index 47336c8..9d9099f 100755
--- a/gio/gdbus-2.0/codegen/codegen_main.py
+++ b/gio/gdbus-2.0/codegen/codegen_main.py
@@ -193,22 +193,23 @@ def codegen_main():
                     '--output at the same time is not allowed')
 
     if args.generate_c_code:
-        outdir = args.output_directory
         header_name = args.generate_c_code + '.h'
-        h_file = os.path.join(outdir, header_name)
+        h_file = os.path.join(args.output_directory, header_name)
         args.header = True
-        c_file = os.path.join(outdir, args.generate_c_code + '.c')
+        c_file = os.path.join(args.output_directory, args.generate_c_code + '.c')
         args.body = True
-    else:
+    elif args.header:
+        if args.output is None:
+            print_error('Using --header requires --output')
+
+        h_file = args.output
+        header_name = os.path.basename(h_file)
+    elif args.body:
         if args.output is None:
-            print_error('Using --header or --body requires --output')
+            print_error('Using --body requires --output')
 
-        if args.header:
-            h_file = args.output
-            header_name = os.path.basename(h_file)
-        elif args.body:
-            c_file = args.output
-            header_name = os.path.splitext(c_file)[0] + '.h'
+        c_file = args.output
+        header_name = os.path.splitext(c_file)[0] + '.h'
 
     all_ifaces = []
     for fname in args.files + args.xml_files:
@@ -226,7 +227,7 @@ def codegen_main():
     docbook = args.generate_docbook
     docbook_gen = codegen_docbook.DocbookCodeGenerator(all_ifaces);
     if docbook:
-        ret = docbook_gen.generate(docbook, outdir)
+        ret = docbook_gen.generate(docbook, args.output_directory)
 
     if args.header:
         with open(h_file, 'w') as outfile:


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