# ---------------------------------------------------------------------- # Make test date/time information file. # if check_exec('DAILYBUILD_GEN_HISTORY', unix_gen_history): Print('making test date information') os.chdir('%s/log' % TestDir) # date_and_time = Util.now('%Y-%m%d %H:%M:%S') lines = [ '** DO NOT EDIT THIS FILE **', 'generated by "%s"' % prog, '- - - %s' % date_and_time ] fio = TextFio(date_record, 'w') if fio.open() == 0: fio.writelines(lines) fio.close() else: Error(prog).error('cannot make "Test.date".') os.chdir(repository) # ---------------------------------------------------------------------- # Copy log files to the web server. # if check_exec('DAILYBUILD_COPYTO_BUILDLOG', unix_copyto_buildlog): Print('copying log files to web') # if Util.is_unix(): tohost = '%s@%s' % (log_user, log_server) todir = '/home/WWW/docroots/springhead/dailybuild/log.unix' fmdir = os.path.abspath('%s/log' % TestDir)
target_dir = '%s/%s' % (srcdir, proj) if options.debug: if proj.lower() in debug_projs: curr_proj = proj.lower() else: os.chdir(target_dir) if options.all or proj.lower() == curr_proj: # Create dependencies definition file for one project. if options.create or options.maketmp: fio = TextFio(one_file, 'w') if fio.open() < 0: Error(prog).error(fio.error()) line = '%s %s' % (proj, dept) vprint('creating one file: "%s" [%s]' % (one_file, line)) fio.writelines([line]) fio.close() # Do process. if trace: print('calling do_process: %s' % ' '.join(flags)) do_process(proj, dept) # Return to original directory. if not options.debug: os.chdir(cwd) if trace: print('LEAVE: %s' % prog) sys.stdout.flush() sys.exit(0)
lines.append('$(INCHDRS):\t') lines.append('\t') lines.append('$(SRCHDRS):\t') lines.append('\t') if verbose: for line in lines: print(line) # ---------------------------------------------------------------------- # ファイルに書き出す. # fobj = TextFio(makefile, 'w', encoding='utf8') if fobj.open() < 0: error.print(fobj.error()) if fobj.writelines(lines, '\n') < 0: error.print(fobj.error()) fobj.close() # ---------------------------------------------------------------------- # 処理終了. # if trace: print('LEAVE: %s' % prog) sys.stdout.flush() sys.exit(0) # end create_mkf.py
else: tbuf += 'Build NG,' # expected result tbuf += r[EXPD][RUN] # if verbose > 1: print(tbuf) obuf.append(tbuf) # ---------------------------------------------------------------------- # Write out to file. # f = TextFio(outfile, 'w', encoding='shift_jis', verbose=verbose) if f.open() < 0: print('%s: %s' % (prog, f.error())) sys.exit(-1) f.set_lines(obuf) f.writelines() f.close() # ---------------------------------------------------------------------- # End of process. # if verbose: print('%s: done' % prog) sys.exit(0) # end: MakeReport.py
if prog_scanned[prog] == '': continue lines.append('%s\t%s' % (prog, prog_scanned[prog])) lines.append('') lines.append('[path]') for key in paths: lines.append('%s\t%s' % (key, paths[key])) lines.append('') lines.append('[data]') for key in parms.keys(): lines.append('%s\t%s' % (key, parms[key])) fio = TextFio(setup_file, 'w') if fio.open() < 0: E.abort('can not open "%s" for writing' % setup_file) if fio.writelines(lines) < 0: E.abort('write error on "%s"' % setup_file) fio.close() # ファイル内容の表示 # print() sf = SetupFile(setup_file) sf.show() print() print(' written to "%s"' % Util.upath(os.path.abspath(setup_file))) # ---------------------------------------------------------------------- # step 10: # CMakeLists.txt がなければ作成(copy)する。 #
fop.mv(sprh, api_header) with open(cpp, 'r') as f: lines_cpp = f.readlines() lines = [] lines.append('#include "%s"\n' % api_header) lines.append('#include "%s"\n' % header) lines.append('#pragma warning(disable:4244)\n') lines.extend(lines_cpp) tmpf = '%s.tmp' % module fio = TextFio(tmpf, 'w', nl='') if fio.open() < 0: msg = 'can\'t open file "%s" (write)' % tmpf Error(prog).abort(msg) rc = fio.writelines(lines) fio.close() if rc != 0: msg = '%s: write failed' % tmpf Error(prog).abort(msg) if os.path.exists(cpp): fop.rm(cpp) fop.mv(tmpf, cpp) # ---------------------------------------------------------------------- # 終了 # sys.exit(0) # end: EmbPythonSwig.py
print() print('---------------------------------------') print('-- write file --') for enc in encs: fname = 'test/foo.' + enc f = TextFio(fname, 'w', encoding=enc, verbose=verbose) if f.open() < 0: Print(f.error()) sys.exit(-1) lines = ['# %s' % fname, '', '', '', 'end'] if enc == 'ascii': lines[2] = ' This is the line to verify encoding.' else: lines[2] = ' これはエンコディングを確認するための行.' f.writelines(lines) f.close() f = TextFio(fname, verbose=verbose) if f.open() < 0: Print(f.error()) sys.exit(-1) leaf = fname.split('/')[-1] Print('"%s": encoding: %s (verify)' % (leaf, f.get_encoding())) f.close() print() sys.exit(0) # end: TextFioTest.py
macro = r'#define USE_CLOSED_SRC' else: print('%s: Warning: "%s" exists but not a directory' % (prog, closed)) lines = [] lines.append(r'// This file is generated by Springhead system.') lines.append(r'') lines.append(r'// Use Springhead/closed source or not.') lines.append(macro) # ---------------------------------------------------------------------- # ファイルに書き出す # fio = TextFio(header_file, 'w') if fio.open() != 0: Error(prog).error('can not open file "%s"' % header_file) if fio.writelines(lines) != 0: Error(prog).error('write failed on file "%s"' % header_file) fio.close() print('%s: "%s" written with "%s"' % (prog, header_file, macro)) # ---------------------------------------------------------------------- # 処理終了 # os.chdir(cwd) if trace: print('LEAVE: %s' % prog) sys.stdout.flush() sys.exit(0) # end: CheckClosedSrc.py