Commit 99d34f65 authored by Florian Müllner's avatar Florian Müllner

gdbus-codegen: Apply --output-directory to generated docs as well

In addition to code, gdbus-codegen can also generate docbook
documentation for DBus interfaces. There's no good reason why
the newly added --output-directory option shouldn't apply to
those generated files as well.

https://bugzilla.gnome.org/show_bug.cgi?id=783201
parent d3b4f7c9
......@@ -21,6 +21,7 @@
import sys
import re
from os import path
from . import config
from . import utils
......@@ -30,9 +31,10 @@ from . import parser
# ----------------------------------------------------------------------------------------------------
class DocbookCodeGenerator:
def __init__(self, ifaces, docbook):
def __init__(self, ifaces, docbook, outdir):
self.ifaces = ifaces
self.docbook = docbook
self.outdir = outdir
self.generate_expand_dicts()
def print_method_prototype(self, i, m, in_synopsis):
......@@ -270,7 +272,7 @@ class DocbookCodeGenerator:
def generate(self):
for i in self.ifaces:
self.out = open('%s-%s.xml'%(self.docbook, i.name), 'w')
self.out = open(path.join(self.outdir, '%s-%s.xml'%(self.docbook, i.name)), 'w')
self.out.write(''%())
self.out.write('<?xml version="1.0" encoding="utf-8"?>\n'%())
self.out.write('<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"\n'%())
......
......@@ -181,14 +181,15 @@ def codegen_main():
for i in all_ifaces:
i.post_process(opts.interface_prefix, opts.c_namespace)
outdir = opts.output_directory
docbook = opts.generate_docbook
docbook_gen = codegen_docbook.DocbookCodeGenerator(all_ifaces, docbook);
docbook_gen = codegen_docbook.DocbookCodeGenerator(all_ifaces, docbook, outdir);
if docbook:
ret = docbook_gen.generate()
c_code = opts.generate_c_code
if c_code:
outdir = opts.output_directory
header_name = c_code + '.h'
h = open(path.join(outdir, header_name), 'w')
c = open(path.join(outdir, c_code + '.c'), 'w')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment