gdbus-codegen: Remove unnecessary parameters from the constructor

The `outdir` and `docbook` parameters are passed to the
`DocbookCodeGenerator` constructor, but these parameters are only
used at docbook generation, which is optional.

The parameters have been removed from the class creation and added
to the `generate` method, where they are actually being used.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
This commit is contained in:
Iñigo Martínez 2018-01-12 11:47:40 +01:00
parent 22772acff8
commit 6c3af1cdda
2 changed files with 5 additions and 7 deletions

View File

@ -31,10 +31,8 @@ from . import parser
# ----------------------------------------------------------------------------------------------------
class DocbookCodeGenerator:
def __init__(self, ifaces, docbook, outdir):
def __init__(self, ifaces):
self.ifaces = ifaces
self.docbook = docbook
self.outdir = outdir
self.generate_expand_dicts()
def print_method_prototype(self, i, m, in_synopsis):
@ -270,9 +268,9 @@ class DocbookCodeGenerator:
self.expand_member_dict_keys = sorted(self.expand_member_dict.keys(), reverse=True)
self.expand_iface_dict_keys = sorted(self.expand_iface_dict.keys(), reverse=True)
def generate(self):
def generate(self, docbook, outdir):
for i in self.ifaces:
self.out = open(path.join(self.outdir, '%s-%s.xml'%(self.docbook, i.name)), 'w')
self.out = open(path.join(outdir, '%s-%s.xml'%(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'%())

View File

@ -190,9 +190,9 @@ def codegen_main():
outdir = args.output_directory
docbook = args.generate_docbook
docbook_gen = codegen_docbook.DocbookCodeGenerator(all_ifaces, docbook, outdir);
docbook_gen = codegen_docbook.DocbookCodeGenerator(all_ifaces);
if docbook:
ret = docbook_gen.generate()
ret = docbook_gen.generate(docbook, outdir)
c_code = args.generate_c_code
if c_code: