def generate_desc_file(self, output_filename, verbose=True): """ Makes the desc file""" # First treat the parameter class if any (classes passed by dictionnary that MUST be converted) param_cls_list = list(self.get_all_param_classes()) # Precompute self.all_enums = list(self.all_enums_gen()) self.all_classes = list(self.all_classes_gen()) self.all_functions = list(self.all_functions_gen()) self.param_cls_list = param_cls_list # checks for c in param_cls_list: for m in CL.get_members(c, True): assert CL.is_public( m ), "Parameter class : all members must be public. %s::%s is not" % ( c.spelling, m.spelling) # analyse the modules and converters that need to be added print "Analysing dependencies" types_being_wrapped_or_converted = param_cls_list + self.all_classes + self.all_enums import_list, converters_list = self.DE( self.get_all_params_ret_type(param_cls_list), types_being_wrapped_or_converted) # Reporting if self.all_classes: print "Wrapping classes:" for c in self.all_classes: print " ", c.spelling if self.all_enums: print "Wrapping enums:" for c in self.all_enums: print " ", c.spelling if self.all_functions: print "Wrapping functions:" for c in self.all_functions: print " ", c.spelling if param_cls_list: print "Generating converters for :" for c in param_cls_list: print " ", c.spelling # Render mako print "Generating " + output_filename tpl = Template(filename=util.script_path() + '/mako/desc.py', strict_undefined=True) rendered = tpl.render(W=self, CL=CL, doc=doc, util=util, import_list=import_list, converters_list=converters_list, using_list=list(self.namespaces) + list(self.namespace_to_factor)) open(output_filename, "w").write(util.clean_end_and_while_char(rendered))
def generate_desc_file(self, output_filename, verbose = True): """ Makes the desc file""" # First treat the parameter class if any (classes passed by dictionnary that MUST be converted) param_cls_list = list(self.get_all_param_classes()) for c in param_cls_list : open('parameters_%s.rst'%c.spelling, 'w').write(doc.doc_param_dict_format(CL.get_members(c, True))) # Precompute self.all_enums = list(self.all_enums_gen()) self.all_classes = list(self.all_classes_gen()) self.all_functions = list(self.all_functions_gen()) self.param_cls_list = param_cls_list # checks for c in param_cls_list: for m in CL.get_members(c, True): assert CL.is_public(m), "Parameter class : all members must be public. %s::%s is not"%(c.spelling, m.spelling) # analyse the modules and converters that need to be added print "Analysing dependencies" types_being_wrapped_or_converted = param_cls_list + self.all_classes + self.all_enums import_list, converters_list = self.DE(self.get_all_params_ret_type(param_cls_list), types_being_wrapped_or_converted) if any(map(self.has_hdf5_scheme, self.all_classes)): converters_list.append("triqs/cpp2py_converters/h5.hpp") # Reporting if self.all_classes: print "Wrapping classes:" for c in self.all_classes: print " ", c.spelling if self.all_enums: print "Wrapping enums:" for c in self.all_enums: print " ", c.spelling if self.all_functions: print "Wrapping functions:" for c in self.all_functions: print " ", c.spelling if param_cls_list: print "Generating converters for :" for c in param_cls_list: print " ", c.spelling # Render mako print "Generating " + output_filename tpl = Template(filename= util.script_path() + '/mako/desc.py', strict_undefined = True) rendered = tpl.render(W = self, CL = CL, doc = doc, util = util, import_list = import_list, converters_list = converters_list, using_list = list(self.namespaces) + list(self.namespace_to_factor)) open(output_filename, "w").write(util.clean_end_and_while_char(rendered))