1: #line 216 "weavers.ipk" 2: from interscript.weavers.multiplexor import multiplexor 3: from interscript.drivers.sinks.bufdisk import named_file_sink 4: import traceback 5: 6: def auto_weaver(pass_frame,basename,autoweave,title=None): 7: if not autoweave: 8: if 'weavers' in pass_frame.master.process.trace: 9: print 'No weavers specified' 10: return multiplexor(pass_frame, []) 11: 12: prefix = pass_frame.master.weaver_prefix 13: eol = pass_frame.master.html_eol 14: directory = pass_frame.master.weaver_directory 15: languages = pass_frame.master.languages 16: if not title: 17: title = pass_frame.master.get_title() 18: if not title: 19: title = basename 20: weavers = [] 21: if not languages: language = [pass_frame.master.get_native_language()] 22: print 'Weaving for languages',languages 23: for language in languages: 24: for w in autoweave: 25: try: 26: modname = 'interscript.weavers.'+w 27: ctorname = modname + '.mk_' +w 28: try: exec 'import '+modname 29: except ImportError: 30: print 'Cannot import module '+modname 31: raise 32: try: exec 'mk = ' + ctorname 33: except AttributeError: 34: print 'Cannot find weaver constructor '+ctorname 35: raise 36: try: 37: w = mk(pass_frame, basename, directory, prefix, eol, title, language) 38: except: 39: print 'Cannot invoke weaver constructor '+ctorname 40: traceback.print_exc() 41: raise 42: weavers.append(w) 43: except KeyboardInterrupt: raise 44: except: 45: print 'Cannot create weaver for',w 46: return multiplexor(pass_frame, weavers) 47: