diff options
Diffstat (limited to 'methods.py')
| -rwxr-xr-x | methods.py | 101 |
1 files changed, 58 insertions, 43 deletions
diff --git a/methods.py b/methods.py index 58cc41f70..21c2293bf 100755 --- a/methods.py +++ b/methods.py @@ -205,7 +205,7 @@ def build_glsl_header( filename ): out_file_base = out_file out_file_base = out_file_base[ out_file_base.rfind("/")+1: ] out_file_base = out_file_base[ out_file_base.rfind("\\")+1: ] - print("out file "+out_file+" base " +out_file_base) +# print("out file "+out_file+" base " +out_file_base) out_file_ifdef = out_file_base.replace(".","_").upper() fd.write("#ifndef "+out_file_ifdef+"\n") fd.write("#define "+out_file_ifdef+"\n") @@ -504,7 +504,7 @@ def build_hlsl_dx9_header( filename ): out_file_base = out_file out_file_base = out_file_base[ out_file_base.rfind("/")+1: ] out_file_base = out_file_base[ out_file_base.rfind("\\")+1: ] - print("out file "+out_file+" base " +out_file_base) +# print("out file "+out_file+" base " +out_file_base) out_file_ifdef = out_file_base.replace(".","_").upper() fd.write("#ifndef "+out_file_ifdef+"\n") fd.write("#define "+out_file_ifdef+"\n") @@ -714,7 +714,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): enumbase = ifdefline[:ifdefline.find("_EN_")]; ifdefline = ifdefline.replace("_EN_","_") line = line.replace("_EN_","_") - print(enumbase+":"+ifdefline); +# print(enumbase+":"+ifdefline); if (enumbase not in enums): enums[enumbase]=[] if (ifdefline not in enums[enumbase]): @@ -805,7 +805,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): out_file_base = out_file out_file_base = out_file_base[ out_file_base.rfind("/")+1: ] out_file_base = out_file_base[ out_file_base.rfind("\\")+1: ] - print("out file "+out_file+" base " +out_file_base) +# print("out file "+out_file+" base " +out_file_base) out_file_ifdef = out_file_base.replace(".","_").upper() fd.write("#ifndef "+out_file_ifdef+class_suffix+"_120\n") fd.write("#define "+out_file_ifdef+class_suffix+"_120\n") @@ -952,10 +952,10 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): x=enums[xv] bits=1 amt = len(x); - print(x) +# print(x) while(2**bits < amt): bits+=1 - print("amount: "+str(amt)+" bits "+str(bits)); +# print("amount: "+str(amt)+" bits "+str(bits)); strs="{" for i in range(amt): strs+="\"#define "+x[i]+"\\n\"," @@ -1083,44 +1083,13 @@ def build_gles2_headers( target, source, env ): def update_version(): - rev = 0 + rev = "custom_build" - try: - f = open("custom_version.txt","rb") - rev = int( f.readline().strip() ) - except: - pass - - if (rev==0): - try: - f = open(".svn/entries") - line = f.readline(); - next_rev = False - while line != "": - line = line.rstrip('\r\n') - if next_rev: - rev = line - break - if line == "dir": - next_rev = True - line = f.readline(); - - if rev != 0: - f = open("version.py") - ver = f.read() - import re - ver = re.sub(r'\$Rev: \d* \$', '$Rev: '+str(rev)+' $', ver) - f = open("version.py", "wb") - f.write(ver) - f.close() - - except: - pass - + if (os.getenv("BUILD_REVISION")!=None): + rev=os.getenv("BUILD_REVISION") + print("Using custom revision: "+rev) import version - - rev=version.revision - rev=rev[5:-1].strip() + f=open("core/version.h","wb") f.write("#define VERSION_SHORT_NAME "+str(version.short_name)+"\n") @@ -1129,6 +1098,8 @@ def update_version(): f.write("#define VERSION_MINOR "+str(version.minor)+"\n") f.write("#define VERSION_REVISION "+str(rev)+"\n") f.write("#define VERSION_STATUS "+str(version.status)+"\n") + import datetime + f.write("#define VERSION_YEAR "+str(datetime.datetime.now().year)+"\n") def parse_cg_file(fname, uniforms, sizes, conditionals): @@ -1322,6 +1293,14 @@ def android_module_manifest(self,file): base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+file f = open(base_path,"rb") self.android_manifest_chunk+=f.read() +def android_module_permission(self,file): + base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+file + f = open(base_path,"rb") + self.android_permission_chunk+=f.read() +def android_module_attribute(self,file): + base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+file + f = open(base_path,"rb") + self.android_appattributes_chunk+=f.read() def disable_module(self): self.disabled_modules.append(self.current_module) @@ -1330,7 +1309,7 @@ def save_active_platforms(apnames,ap): for x in ap: pth = x+"/logo.png" - print("open path: "+pth) +# print("open path: "+pth) pngf=open(pth,"rb"); b=pngf.read(1); str=" /* AUTOGENERATED FILE, DO NOT EDIT */ \n" @@ -1347,3 +1326,39 @@ def save_active_platforms(apnames,ap): logow = open(wf,"wb") logow.write(str) + +def colored(sys,env): + + #If the output is not a terminal, do nothing + if not sys.stdout.isatty(): + return + + colors = {} + colors['cyan'] = '\033[96m' + colors['purple'] = '\033[95m' + colors['blue'] = '\033[94m' + colors['green'] = '\033[92m' + colors['yellow'] = '\033[93m' + colors['red'] = '\033[91m' + colors['end'] = '\033[0m' + + compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) + java_compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) + compile_shared_source_message = '%sCompiling shared %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) + link_program_message = '%sLinking Program %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + link_library_message = '%sLinking Static Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + ranlib_library_message = '%sRanlib Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + link_shared_library_message = '%sLinking Shared Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + java_library_message = '%sCreating Java Archive %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + + env.Append( CXXCOMSTR=[compile_source_message] ) + env.Append( CCCOMSTR=[compile_source_message] ) + env.Append( SHCCCOMSTR=[compile_shared_source_message] ) + env.Append( SHCXXCOMSTR=[compile_shared_source_message] ) + env.Append( ARCOMSTR=[link_library_message] ) + env.Append( RANLIBCOMSTR=[ranlib_library_message] ) + env.Append( SHLINKCOMSTR=[link_shared_library_message] ) + env.Append( LINKCOMSTR=[link_program_message] ) + env.Append( JARCOMSTR=[java_library_message] ) + env.Append( JAVACCOMSTR=[java_compile_source_message] ) + |
