|
Atrinik Server 1.0
|
00001 # Simple script to assist in updating project files for CodeBlocks and 00002 # VisualC when new files are added/removed. 00003 00004 import os 00005 00006 directory = "../../src" 00007 fp_cb = open("codeblocks.txt", "w") 00008 vc_data = {} 00009 00010 def scan(directory): 00011 nodes = os.listdir(directory) 00012 00013 for node in nodes: 00014 path = directory + "/" + node 00015 00016 if os.path.isdir(path): 00017 if node == "plugins" or node == "tests": 00018 continue 00019 00020 if not node in vc_data: 00021 vc_data[node] = [] 00022 00023 scan(path) 00024 elif os.path.isfile(path): 00025 if node == "autoconf.h": 00026 continue 00027 00028 if path[-2:] == ".c" or path[-2:] == ".h" or path[-2:] == ".l": 00029 new_path = path.replace("/", "\\") 00030 00031 if path[-2:] != ".l": 00032 fp_cb.write("\n\t\t<Unit filename=\"..\{0}\">\n\t\t\t<Option compilerVar=\"CC\" />\n\t\t</Unit>".format(new_path)) 00033 00034 if path[-2:] == ".h": 00035 vc_data["include"].append(new_path) 00036 else: 00037 vc_data[os.path.basename(os.path.dirname(path))].append(new_path) 00038 00039 scan(directory) 00040 fp_cb.close() 00041 00042 fp_vc = open("visualc-include.txt", "w") 00043 fp_vc.write("\n\t\t<Filter\n\t\t\tName=\"Header Files\"\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"\n\t\t\t>") 00044 vc_data["include"].sort() 00045 00046 for f in vc_data["include"]: 00047 fp_vc.write("\n\t\t\t<File\n\t\t\t\tRelativePath=\"..\{0}\"\n\t\t\t\t>\n\t\t\t</File>".format(f)) 00048 00049 fp_vc.write("\n\t\t</Filter>") 00050 fp_vc.close() 00051 00052 fp_vc = open("visualc-source.txt", "w") 00053 fp_vc.write("\n\t\t<Filter\n\t\t\tName=\"Source Files\"\n\t\t\tFilter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"\n\t\t\t>") 00054 00055 for d in vc_data: 00056 if d == "include": 00057 continue 00058 00059 vc_data[d].sort() 00060 fp_vc.write("\n\t\t\t<Filter\n\t\t\t\tName=\"{0}\"\n\t\t\t\t>".format(d)) 00061 00062 for f in vc_data[d]: 00063 fp_vc.write("\n\t\t\t\t<File\n\t\t\t\t\tRelativePath=\"..\{0}\"\n\t\t\t\t\t>".format(f)) 00064 00065 if f[-2:] == ".l": 00066 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t\t\t\t\tCommandLine=\"..\\tools\\flex.exe -i -Pyy_{0} -o$(InputDir)$(InputName).c $(InputPath)
\"\n\t\t\t\t\t\t\tOutputs=\"$(InputDir)$(InputName).c\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(os.path.basename(f.replace("\\", "/"))[:-2])) 00067 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t\t\t\t\tCommandLine=\"..\\tools\\flex.exe -i -Pyy_{0} -o$(InputDir)$(InputName).c $(InputPath)
\"\n\t\t\t\t\t\t\tOutputs=\"$(InputDir)$(InputName).c\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(os.path.basename(f.replace("\\", "/"))[:-2])) 00068 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t\t\t\t\tCommandLine=\"..\\tools\\flex.exe -i -Pyy_{0} -o$(InputDir)$(InputName).c $(InputPath)
\"\n\t\t\t\t\t\t\tOutputs=\"$(InputDir)$(InputName).c\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(os.path.basename(f.replace("\\", "/"))[:-2])) 00069 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t\t\t\t\tCommandLine=\"..\\tools\\flex.exe -i -Pyy_{0} -o$(InputDir)$(InputName).c $(InputPath)
\"\n\t\t\t\t\t\t\tOutputs=\"$(InputDir)$(InputName).c\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(os.path.basename(f.replace("\\", "/"))[:-2])) 00070 else: 00071 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00072 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00073 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00074 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00075 fp_vc.write("\n\t\t\t\t</File>") 00076 00077 fp_vc.write("\n\t\t\t</Filter>") 00078 00079 fp_vc.write("\n\t\t</Filter>") 00080 fp_vc.close()
1.7.4