def run_wandbox(code, includes, impliments, options): w = Wandbox() w.compiler(options.compiler) opt = [] if options.options: opt = options.options.split(',') elif options.default: opt = get_default_options(options.compiler) if options.boost: opt = list(filter(lambda s: s.find('boost') == -1, opt)) opt.append('boost-' + str(options.boost)) if options.sprout and 'sprout' not in opt: opt.append('sprout') if options.msgpack and 'msgpack' not in opt: opt.append('msgpack') w.options(','.join(opt)) if options.stdin: w.stdin(options.stdin) if options.compiler_option_raw: co = '\n'.join(options.compiler_option_raw) co = co.replace('\\n', '\n') if options.compiler == "clang-3.5": co += "\n-DIUTEST_HAS_HDR_CXXABI=0" if options.compiler in ["clang-3.2", "clang-3.1", "clang-3.0"]: co += "\n-Qunused-arguments" w.compiler_options(co) if options.runtime_option_raw: ro = '' for opt in options.runtime_option_raw: ro += opt + '\n' ro = ro.replace('\\n', '\n') w.runtime_options(ro) if options.save: w.permanent_link(options.save) for filename in impliments.keys(): w.add_compiler_options(filename) if options.verbose: w.dump() w.code(code) add_files(w, impliments) add_files(w, includes) if options.dryrun: sys.exit(0) def run(retries): try: return w.run() except HTTPError as e: if e.response.status_code == 504 and retries > 0: try: print(e.message) except: pass print("wait 30sec...") sleep(30) return run(retries - 1) else: raise except: raise return run(3)