def main(): from argparse import ArgumentParser o = ArgumentParser() o.add_argument('-I', action='append', dest='incdirs', default=['.'], help="Directory to search for imported files") o.add_argument('config', help='Config file to load') o.add_argument('header_output', metavar='FILE', help="Quick stub header output file") o.add_argument('stub_output', metavar='FILE', help="C++ source output file") o.add_argument('makedepend_output', metavar='FILE', help="gnumake dependencies output file") global options options = o.parse_args() # Instantiate the parser. global p p = xpidl.IDLParser() conf = readConfigFile(options.config) with FileAvoidWrite(options.header_output) as fh: idl_paths = print_header_file(fh, conf) with FileAvoidWrite(options.stub_output) as fh: idl_paths |= print_cpp_file(fh, conf) with FileAvoidWrite(options.makedepend_output) as fh: write_dep_makefile(fh, options.stub_output, idl_paths)
def test_write_dep_makefile(self): out = StringIO() write_dep_makefile(out, "target", ["b", "c", "a"]) self.assertEqual(out.getvalue(), "target: b c a\n" + "a b c:\n")
def test_write_dep_makefile(self): out = StringIO() write_dep_makefile(out, 'target', ['b', 'c', 'a']) self.assertEqual(out.getvalue(), 'target: b c a\n' + 'a b c:\n')