📄 rztbld.py
字号:
str_copycommand = '\tdrpog /noerr_copy ' project.writeln('\tdel CopyLogFile.txt') specfile_path = os.path.join(project.src_root_path, component[2]) if platform.type == 'unix': specfile_path = string.translate(specfile_path, unix_path_translation_table) index = string.rfind(specfile_path, '/') else: index = string.rfind(specfile_path, '\\') specfile_name = specfile_path[index+1:] specfile_out_path = os.path.join(temp_dir, specfile_name) if project.target_name != project.module_dir: specfile_name = specfile_name + '_' + project.target_name ## Copy spec file of a component if sysinfo.host_type == 'mac': spec_path = os.path.join(project.src_root_path, component[2]) index = string.rfind(temp_dir, ':') spec_path = temp_dir[:index] spec_path = os.path.join(spec_path, specfile_name) corrected_file = string.translate(spec_path, mac_path_translation_table) global g_rzt_apple_script g_rzt_apple_script.Append( '-- Copy Files and Folders into Temporary Directory', 'tell application "Finder"', 'with timeout of 99999 seconds', 'Duplicate file "%s" to folder "%s" with replacing' % (corrected_file, temp_dir) ) else: project.writeln(str_copycommand + specfile_name + ' ' + specfile_out_path) for dll in dlls: platform.versioning.version = '' dll_name = platform.versioning.create_dll_name(dll[0], dll[2]) dll_location = os.path.join(dll[2], project.output_dir) dll_location = os.path.join(dll_location, dll_name) if dll[1] == '': dest = temp_dir else: dest = os.path.join(temp_dir, dll[1]) if sysinfo.host_type == 'mac': global g_rzt_apple_script g_rzt_apple_script.Append( 'Duplicate file "%s" to folder "%s" with replacing' % (os.path.join(project.src_root_path, dll_location), dest) ) else: project.writeln(str_copycommand + os.path.join(project.src_root_path, dll_location) + ' ' + dest) for file in files: if file[1] == '': dest = temp_dir else: dest = os.path.join(temp_dir, file[1]) if sysinfo.host_type == 'mac': srcfile = string.translate(file[0], mac_path_translation_table) srcfile = project.src_root_path + ':' + srcfile corrected_dest = string.translate(dest, mac_path_translation_table) if os.path.isdir(srcfile): # copy entire folder global g_rzt_apple_script g_rzt_apple_script.Append( 'Copy folder "%s" to folder "%s"' % (srcfile, corrected_dest) ) else: global g_rzt_apple_script g_rzt_apple_script.Append( 'Duplicate file "%s" to folder "%s" with replacing' % (srcfile, corrected_dest) ) else: if platform.type == 'unix': srcfile = string.translate(file[0], unix_path_translation_table) temp = str_copycommand + '"' + os.path.join(project.src_root_path, srcfile) + '"' + ' ' + dest project.writeln(string.replace(temp, '*', '"*"')) else: project.writeln(str_copycommand + '"' + os.path.join(project.src_root_path, file[0]) + '"' + ' ' + dest) if sysinfo.host_type == 'mac': global g_rzt_apple_script g_rzt_apple_script.Append( 'end timeout', 'end tell' )def Strip(platform, project, dirs): # Windows doesn't seem to have problems w/symbols, and the # cygnus strip command does strange things for me. if (platform.type != 'unix'): return 'no strip support for this platform' temp_dir = os.path.join(project.src_root_path, project.module_dir) temp_dir = os.path.join(temp_dir, temp_dir_name) for dir in dirs: target = os.path.join(temp_dir,dir[0]) target = os.path.join(target,dir[1]) if (platform.name == 'irix6'): project.writeln('\t' + 'strip -f ' + target) else: project.writeln('\t' + 'strip ' + target)def CreateRZT(platform, project, rzt_file_name, bind_dirs): global pnpkg_path global g_compression_type archive_extension = '.rzt' #if(sysinfo.host_type == 'mac' and g_compression_type != ''): # archive_extension = '.rxt' if(g_compression_type == 'xtr'): archive_extension = '.rxt' if(g_compression_type == 'rfx'): archive_extension = '.rfx' if sysinfo.host_type == 'win32' or platform.name == 'win16': ## copy RICHFX compression tools if (g_compression_type == 'rfx'): rnrichfx_path = os.path.join(os.pardir, 'rnrichfx') project.writeln('\t' + platform.copy.cmd + ' ' + os.path.join(rnrichfx_path, 'vCurrentCMD.exe') + ' ' + project.target_dir) project.writeln('\t' + platform.copy.cmd + ' ' + os.path.join(rnrichfx_path, 'Bender.dll') + ' ' + project.target_dir) project.writeln('\t' + platform.copy.cmd + ' ' + os.path.join(rnrichfx_path, 'dBenderC.dll') + ' ' + project.target_dir) project.writeln('\t' + platform.copy.cmd + ' ' + os.path.join(rnrichfx_path, 'makecab.exe') + ' ' + project.target_dir) ## MAKE ALL TEMP FILES WRITEABLE... project.writeln('\tattrib -r ' + os.path.join(temp_dir_name, '*.*') + ' /s') ## RUN DISTCODE if product_distcode != '' and product_executable != '': project.writeln('\tdistcode ' + os.path.join(temp_dir_name, product_executable) + ' ' + product_distcode) for dist_file in distcode_files: project.writeln('\tdistcode ' + os.path.join(temp_dir_name, dist_file) + ' ' + product_distcode) if (sysinfo.host_type == 'win32'): project.writeln('\tcd ' + temp_dir_name) for bind_dir in bind_dirs: project.writeln('\tcd ' + bind_dir) project.writeln('\tEDITBIN /BIND:PATH=.;..\\ *.dll') project.writeln('\tcd ' + os.pardir) project.writeln('\tcd ' + os.pardir) if (sysinfo.host_type == 'win32'): pnpkg_path = project.target_dir else: pnpkg_path = os.path.join(project.src_root_path, 'pnpkg') pnpkg_path = os.path.join(pnpkg_path, project.output_dir) pnpkg_path = os.path.join(pnpkg_path, 'pnpkg') ## RUN RICHFX compression tool if (g_compression_type == 'rfx'): if (sysinfo.host_type == 'win32'): rnrichfx_path = os.path.join(project.target_dir, 'vCurrentCMD.exe') ## xxtmpxx.rfx is a temp hardcoded archive filename project.writeln('\t' + rnrichfx_path + ' N xxtmpxx.rfx ' + os.path.join(temp_dir_name, '*.*')) ## RUN PNPKG if (g_compression_type == ''): if platform.type == 'unix': CreateInstCompressionHeader(platform, project, 'zlib') #elif sysinfo.host_type == 'mac': # CreateInstCompressionHeader(platform, project, 'xtr') else: CreateInstCompressionHeader(platform, project, 'ict') ## Should we not run CreateInstComressionHeader(platform, project, g_compression_type) if g_compression_type was set?? - Hubbe if sysinfo.host_type == 'win32' or platform.name == 'win16': project.writeln('\tcd ' + temp_dir_name) if (g_compression_type == ''): project.writeln('\t' + os.path.join(os.pardir, pnpkg_path) + ' -e ' + os.path.join(os.pardir, rzt_file_name) + '.hdr -f ' + os.path.join(os.pardir, rzt_file_name) + archive_extension + ' *.*') else: project.writeln('\t' + os.path.join(os.pardir, pnpkg_path) + ' -c ' + g_compression_type + ' -e ' + os.path.join(os.pardir, rzt_file_name) + '.hdr -f ' + os.path.join(os.pardir, rzt_file_name) + archive_extension + ' *.*') project.writeln('\tcd ' + os.pardir) elif platform.type == 'unix': ## MAKE ALL TEMP FILES WRITEABLE... project.writeln('\t(cd ' + temp_dir_name + '; chmod -R a+x *)') ## RUN DISTCODE # if product_distcode != '' and product_executable != '': # project.writeln('\tdistcode ' + product_executable + ' ' + product_distcode) ## RUN PNPKG path_to_pnpkg = os.path.join(os.pardir, os.pardir) path_to_pnpkg = os.path.join(path_to_pnpkg, 'pnpkg') path_to_pnpkg = os.path.join(path_to_pnpkg, project.output_dir) path_to_archive = os.path.join(os.pardir, rzt_file_name + archive_extension) path_to_header = os.path.join(os.pardir, rzt_file_name + '.hdr') if (g_compression_type == ''): project.writeln('\t(cd ' + temp_dir_name + '; ' + os.path.join(path_to_pnpkg,'pnpkg')+ ' -ve ' + path_to_header + ' -f ' + path_to_archive + ' *)') else: project.writeln('\t(cd ' + temp_dir_name + '; ' + os.path.join(path_to_pnpkg,'pnpkg')+ ' -c ' + g_compression_type + ' -ve ' + \ path_to_header + ' -f ' + path_to_archive + ' *)') elif sysinfo.host_type == 'mac': # create a binary data file required by the PnPkg application # create a unique name for each .bin file datafile_path = os.path.join(project.src_root_path, project.module_dir, rzt_file_name + '.bin') header_path = os.path.join(project.src_root_path, project.module_dir, rzt_file_name + '.hdr') archive_path = os.path.join(project.src_root_path, project.module_dir, rzt_file_name + archive_extension) temp_dir = os.path.join(project.src_root_path, project.module_dir, temp_dir_name) o = open(datafile_path, 'wb') items = 0 tempstr = os.path.join(temp_dir, '*\000') if (g_compression_type == ''): o.write(struct.pack('h', items+6)) else: o.write(struct.pack('h', items+8)) o.write('pnpkg\000') if (g_compression_type != ''): o.write('-c\000') o.write(g_compression_type + '\000') o.write('-e\000') o.write(header_path + '\000') o.write('-f\000') o.write(archive_path + '\000') o.write(tempstr) o.close() ## test to see if the pnpkg application built; if it didn't, then ## don't try to call it because a dialog will pop up and hang the ## remote build system; perhaps we should just sys.exit(1) at this ## point so the build system knows not to try and run the script --JMP if os.path.exists(pnpkg_path): global g_rzt_apple_script g_rzt_apple_script.Append( '-- Make the Archive', 'tell application "%s"' % (pnpkg_path), 'with timeout of 99999 seconds', 'run', 'open "%s"' % (datafile_path), 'end timeout', 'end tell')def AddRebaseFile(file): global g_rebasedirs if (file != ''): if(-1 == string.find(g_rebasedirs, file)): g_rebasedirs = (g_rebasedirs + file + ' ')def AddRebaseDirectory(dir): global g_rebasedirs if (dir == ''): if(-1 == string.find(g_rebasedirs, ' *.dll ')): g_rebasedirs = (g_rebasedirs + '*.dll ') else: if(-1 == string.find(g_rebasedirs, dir)): g_rebasedirs = (g_rebasedirs + dir + '\\*.dll ')def RemoveRebaseDirectory(dir): global g_rebasedirs if (dir == ''): g_rebasedirs = string.replace(g_rebasedirs, ' *.dll ', ' ') else: g_rebasedirs = string.replace(g_rebasedirs,' ' + dir + '\\*.dll ', ' ')def RunRebase(project, parameters): global g_rebasedirs project.writeln('\tcd ' + temp_dir_name) project.writeln('\tcall rebase ' + parameters + ' ' + g_rebasedirs) project.writeln('\tcd..')def CreateInstaller(platform, project): global g_compression_type archive_extension = '.rzt' #if(sysinfo.host_type == 'mac' and g_compression_type == ''): # archive_extension = '.rxt' if(g_compression_type == 'xtr'): archive_extension = '.rxt' if(g_compression_type == 'rfx'): archive_extension = '.rfx' rzt_src_path = os.path.join(project.src_root_path, project.module_dir) rzt_src_path = os.path.join(rzt_src_path, project.target_name + archive_extension) if sysinfo.host_type == 'win32' or platform.name == 'win16': project.writeln('\tcd ' + os.pardir) project.writeln('\tcd ' + 'setshell') project.writeln('\tnmake clean') project.writeln('\tnmake depend') ## Copy richfx decompression engine file if (g_compression_type == 'rfx'): rnrichfx_path = os.path.join(os.pardir, 'rnrichfx') rnrichfx_path = os.path.join(rnrichfx_path, 'nprfxins.dll') project.writeln('\t' + platform.copy.cmd + ' ' + rnrichfx_path + ' nprfxins.dll') ## Copy RZT file project.writeln('\t' + platform.copy.cmd + ' ' + rzt_src_path + ' archive.rzt')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -