def generate_example(filename): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') if not os.path.exists(ob['name']): os.mkdir(ob['name']) os.chdir('./{0}'.format(ob['name'])) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() os.chdir('../../.') return ob['name']
def generate_example_code(ob): ''' Generate the example code for a pkg_code object (big dictionary structure of information from an XML file). :param ob: the pkg_code object :return: returns nothing ''' ex = CppExampleFile.CppExampleFile(ob) ex.write_file() ex.close_file()
def generate_example(filename): """ Generate a C++ example. :param filename: XML file to parse :return: package name, e.g. 'dyn' """ ob = set_up(filename) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() os.chdir(os.path.normpath('../../.')) return ob['name']
def write_example_files(self): """ Write example files. I think this is only used by the test code. """ name = '{0}-package'.format(self.package) ext = PackageFile.PackageFile(name, self.package, False, True) if self.verbose: print('Writing file {0}'.format(ext.fileout.filename)) ext.write_example_file() ext.close_file() os.chdir('c++/{0}'.format(self.package)) txt = CMakeListsFile.CMakeListsFile('CMakeLists', self.package) if self.verbose: print('Writing file {0}'.format(txt.fileout.filename)) txt.write_file() txt.close_file() ex = CppExampleFile.CppExampleFile(self.pkg_object) if self.verbose: print('Writing file {0}'.format(ex.filename)) ex.write_file() ex.close_file()
def generate_example_code(ob): ex = CppExampleFile.CppExampleFile(ob) ex.write_file() ex.close_file()