From 817dd7ccbb166b27c93706dffc5c0c0d59fd87f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Oct 2016 19:05:14 +0100 Subject: [PATCH] style: Fix PEP8 blank lines issues in Python files Done with `autopep8 --select=E3,W3`, fixes: - E301 - Add missing blank line. - E302 - Add missing 2 blank lines. - E303 - Remove extra blank lines. - E304 - Remove blank line following function decorator. - E309 - Add missing blank line. - W391 - Remove trailing blank lines. --- SConstruct | 5 -- core/make_binders.py | 1 - doc/tools/doc_merge.py | 12 ++-- doc/tools/doc_status.py | 13 ++-- doc/tools/makedoku.py | 15 ----- doc/tools/makehtml.py | 39 ++---------- doc/tools/makemd.py | 1 - doc/tools/makerst.py | 6 +- methods.py | 63 ++++++++------------ modules/chibi/config.py | 1 + modules/cscript/config.py | 3 - modules/dds/config.py | 1 + modules/enet/config.py | 1 + modules/etc1/config.py | 1 + modules/freetype/config.py | 1 + modules/gdscript/config.py | 3 - modules/gridmap/config.py | 3 - modules/ik/config.py | 3 - modules/jpg/config.py | 1 + modules/mpc/config.py | 1 + modules/ogg/config.py | 1 + modules/openssl/config.py | 1 + modules/opus/config.py | 1 + modules/pbm/config.py | 1 + modules/pvr/config.py | 1 + modules/regex/config.py | 3 +- modules/squish/config.py | 1 + modules/theora/config.py | 1 + modules/visual_script/config.py | 3 - modules/vorbis/config.py | 1 + modules/webm/config.py | 1 + modules/webp/config.py | 1 + platform/android/detect.py | 7 ++- platform/bb10/detect.py | 6 +- platform/haiku/SCsub | 1 + platform/haiku/detect.py | 6 ++ platform/iphone/detect.py | 5 +- platform/javascript/detect.py | 6 +- platform/osx/detect.py | 10 ++-- platform/server/detect.py | 7 +-- platform/windows/detect.py | 17 +++--- platform/winrt/detect.py | 6 +- platform/x11/detect.py | 10 +--- scene/resources/default_theme/make_header.py | 1 - tools/SCsub | 4 -- tools/editor/SCsub | 8 --- tools/editor/icons/SCsub | 4 +- tools/scripts/addheader.py | 2 - tools/scripts/file-hex-array.py | 3 + tools/scripts/make_bmfhdr.py | 3 - tools/scripts/make_glwrapper.py | 5 -- tools/scripts/makeargs.py | 6 -- tools/scripts/svgs_2_pngs.py | 1 - 53 files changed, 115 insertions(+), 193 deletions(-) diff --git a/SConstruct b/SConstruct index ee3a54b5ab5..a1c013422e3 100644 --- a/SConstruct +++ b/SConstruct @@ -85,7 +85,6 @@ env_base.use_ptrcall = False env_base.split_drivers = False - env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository env_base.__class__.android_add_dependency = methods.android_add_dependency env_base.__class__.android_add_java_dir = methods.android_add_java_dir @@ -199,7 +198,6 @@ elif env_base['p'] != "": env_base["platform"] = selected_platform - if selected_platform in platform_list: sys.path.append("./platform/" + selected_platform) @@ -298,7 +296,6 @@ if selected_platform in platform_list: sys.path.remove("./platform/" + selected_platform) sys.modules.pop('detect') - env.module_list = [] for x in module_list: @@ -314,7 +311,6 @@ if selected_platform in platform_list: sys.path.remove(tmppath) sys.modules.pop('config') - if (env.use_ptrcall): env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']); @@ -371,7 +367,6 @@ if selected_platform in platform_list: # has a purpose. # env['MSVS_VERSION']='9.0' - # Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options. # And runs vcvarsall bat for the propper arhitecture and scons for propper configuration env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2' diff --git a/core/make_binders.py b/core/make_binders.py index 5debf1345ce..ef71c4264b8 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -251,7 +251,6 @@ def run(target, source, env): else: text += t - f = open(target[0].path, "w") f.write(text) f.close() diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 747a8703784..d9f7cc9daac 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -16,6 +16,7 @@ tab = 0 old_classes = {} + def write_string(_f, text, newline=True): for t in range(tab): _f.write("\t") @@ -23,6 +24,7 @@ def write_string(_f, text, newline=True): if (newline): _f.write("\n") + def escape(ret): ret = ret.replace("&", "&"); ret = ret.replace("<", ">"); @@ -36,6 +38,7 @@ def inc_tab(): global tab tab += 1 + def dec_tab(): global tab tab -= 1 @@ -43,12 +46,14 @@ def dec_tab(): write_string(f, '') write_string(f, '') + def get_tag(node, name): tag = "" if (name in node.attrib): tag = ' ' + name + '="' + escape(node.attrib[name]) + '" ' return tag + def find_method_descr(old_class, name): methods = old_class.find("methods") @@ -61,6 +66,7 @@ def find_method_descr(old_class, name): return None + def find_signal_descr(old_class, name): signals = old_class.find("signals") @@ -73,6 +79,7 @@ def find_signal_descr(old_class, name): return None + def find_constant_descr(old_class, name): if (old_class == None): @@ -85,6 +92,7 @@ def find_constant_descr(old_class, name): return m.text return None + def write_class(c): class_name = c.attrib["name"] print("Parsing Class: " + class_name) @@ -93,7 +101,6 @@ def write_class(c): else: old_class = None - category = get_tag(c, "category") inherits = get_tag(c, "inherits") write_string(f, '') @@ -106,7 +113,6 @@ def write_class(c): if (old_brief_descr != None): write_string(f, escape(old_brief_descr.text.strip())) - write_string(f, "") write_string(f, "") @@ -207,5 +213,3 @@ for c in list(old_doc): for c in list(new_doc): write_class(c) write_string(f, '\n') - - diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 4e108f352ea..e05bcd63e78 100755 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -75,7 +75,6 @@ colors = { overall_progress_description_weigth = 10 - ################################################################################ # Utils # ################################################################################ @@ -85,6 +84,7 @@ def validate_tag(elem, tag): print('Tag mismatch, expected "' + tag + '", got ' + elem.tag) sys.exit(255) + def color(color, string): if flags['c']: color_format = '' @@ -95,16 +95,18 @@ def color(color, string): return string ansi_escape = re.compile(r'\x1b[^m]*m') + + def nonescape_len(s): return len(ansi_escape.sub('', s)) - ################################################################################ # Classes # ################################################################################ class ClassStatusProgress: + def __init__(self, described=0, total=0): self.described = described self.total = total @@ -146,6 +148,7 @@ class ClassStatusProgress: class ClassStatus: + def __init__(self, name=''): self.name = name self.has_brief_description = True @@ -239,7 +242,6 @@ class ClassStatus: return status - ################################################################################ # Arguments # ################################################################################ @@ -304,7 +306,6 @@ if len(input_file_list) < 1 or flags['h']: sys.exit(0) - ################################################################################ # Parse class list # ################################################################################ @@ -334,7 +335,6 @@ if len(input_class_list) < 1: input_class_list = class_names - ################################################################################ # Make output table # ################################################################################ @@ -374,8 +374,6 @@ for cn in input_class_list: table.append(row) - - ################################################################################ # Print output table # ################################################################################ @@ -427,4 +425,3 @@ print(divider_string) if total_status.is_ok() and not flags['g']: print('All listed classes are ' + color('part_good', 'OK') + '!') - diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py index 32a52a584af..49a960c43a8 100644 --- a/doc/tools/makedoku.py +++ b/doc/tools/makedoku.py @@ -53,14 +53,12 @@ def make_class_list(class_list, columns): indexers += [n] last_initial = n[:1] - row_max = 0 for n in range(0, columns): if (len(fit_columns[n]) > row_max): row_max = len(fit_columns[n]) - for r in range(0, row_max): s = "|" for c in range(0, columns): @@ -139,7 +137,6 @@ def dokuize_text(text): else: tag_text = "[" + tag_text + "]" - text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -173,8 +170,6 @@ def make_method(f, name, m, declare, event=False): mdata["argidx"].append(idx) mdata[idx] = a - - if (not event): if (-1 in mdata["argidx"]): s += make_type(mdata[-1].attrib["type"]) @@ -212,7 +207,6 @@ def make_method(f, name, m, declare, event=False): if ("default" in arg.attrib): s += "=" + arg.attrib["default"] - argfound = True if (argfound): @@ -270,8 +264,6 @@ def make_doku_class(node): s += " - " + c.text.strip() f.write(s + "\n") - - constants = node.find("constants") if(constants != None and len(list(constants)) > 0): f.write("===== Numeric Constants ======\n") @@ -284,7 +276,6 @@ def make_doku_class(node): s += " - " + c.text.strip() f.write(s + "\n") - descr = node.find("description") if (descr != None and descr.text.strip() != ""): f.write("===== Description ======\n") @@ -305,10 +296,6 @@ def make_doku_class(node): f.write(dokuize_text(d.text.strip())) f.write("\n") - - - - """ div=ET.Element("div") div.attrib["class"]="class"; @@ -510,5 +497,3 @@ make_class_list(class_names, 4) for cn in class_names: c = classes[cn] make_doku_class(c) - - diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py index 95a35960b74..369f559f25b 100644 --- a/doc/tools/makehtml.py +++ b/doc/tools/makehtml.py @@ -12,9 +12,11 @@ html_escape_table = { html_unescape_table = {v: k for k, v in html_escape_table.items()} + def html_escape(text): return escape(text, html_escape_table) + def html_unescape(text): return unescape(text, html_unescape_table) @@ -41,12 +43,14 @@ def validate_tag(elem, tag): print("Tag mismatch, expected '" + tag + "', got " + elem.tag); sys.exit(255) + def make_html_bottom(body): # make_html_top(body,True) ET.SubElement(body, "hr") copyright = ET.SubElement(body, "span") copyright.text = "Copyright 2008-2010 Codenix SRL" + def make_html_top(body, bottom=False): if (bottom): @@ -83,8 +87,6 @@ def make_html_top(body, bottom=False): ET.SubElement(body, "hr") - - def make_html_class_list(class_list, columns): div = ET.Element("div") @@ -128,7 +130,6 @@ def make_html_class_list(class_list, columns): if (len(fit_columns[n]) > row_max): row_max = len(fit_columns[n]) - for r in range(0, row_max): tr = ET.SubElement(table, "tr") for c in range(0, columns): @@ -155,7 +156,6 @@ def make_html_class_list(class_list, columns): a.attrib["href"] = link a.text = classname - if (not single_page): cat_class_list = ET.Element("html") csscc = ET.SubElement(cat_class_list, "link") @@ -169,9 +169,6 @@ def make_html_class_list(class_list, columns): else: cat_class_parent = div - - - h1 = ET.SubElement(cat_class_parent, "h2") h1.text = "Class List By Category" @@ -227,7 +224,6 @@ def make_html_class_list(class_list, columns): catet_out = ET.ElementTree(cat_class_list) catet_out.write("category.html") - if (not single_page): inh_class_list = ET.Element("html") cssic = ET.SubElement(inh_class_list, "link") @@ -240,9 +236,6 @@ def make_html_class_list(class_list, columns): else: inh_class_parent = div - - - h1 = ET.SubElement(inh_class_parent, "h2") h1.text = "Class List By Inheritance" @@ -268,7 +261,6 @@ def make_html_class_list(class_list, columns): else: parent_list = parent_list.find("list") - else: parent_list = itemlist @@ -277,7 +269,6 @@ def make_html_class_list(class_list, columns): class_inh_table[clss.attrib["name"]] = item make_type(clss.attrib["name"], item) - for c in class_list: add_class(classes[c]) @@ -286,10 +277,6 @@ def make_html_class_list(class_list, columns): catet_out = ET.ElementTree(inh_class_list) catet_out.write("inheritance.html") - - - - # h1=ET.SubElement(div,"h2") #h1.text="Class List By Inheritance" @@ -314,7 +301,6 @@ def make_type(p_type, p_parent): span.text = p_type + " " - def make_text_def(class_name, parent, text): text = html_escape(text) pos = 0 @@ -370,7 +356,6 @@ def make_text_def(class_name, parent, text): else: tag_text = "[" + tag_text + "]" - text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -384,17 +369,13 @@ def make_text_def(class_name, parent, text): print("Error parsing description text: '" + text + "'") sys.exit(255) - return tnode - - def make_method_def(name, m, declare, event=False): mdata = {} - if (not declare): div = ET.Element("tr") div.attrib["class"] = "method" @@ -457,7 +438,6 @@ def make_method_def(name, m, declare, event=False): span = ET.SubElement(func_parent, "span") span.text = " " - make_type(arg.attrib["type"], func_parent) span = ET.SubElement(func_parent, "span") @@ -465,7 +445,6 @@ def make_method_def(name, m, declare, event=False): if ("default" in arg.attrib): span.text = span.text + "=" + arg.attrib["default"] - span = ET.SubElement(func_parent, "span") span.attrib["class"] = "symbol" if (len(mdata["argidx"])): @@ -533,7 +512,6 @@ def make_html_class(node): else: a.attrib["href"] = "category.html#" + catname - methods = node.find("methods") if(methods != None and len(list(methods)) > 0): @@ -561,7 +539,6 @@ def make_html_class(node): #li = ET.SubElement(div2, "li") event_table.append(make_method_def(node.attrib["name"], m, False, True)) - members = node.find("members") if(members != None and len(list(members)) > 0): @@ -583,7 +560,6 @@ def make_html_class(node): span.attrib["class"] = "member_description" span.text = c.text - constants = node.find("constants") if(constants != None and len(list(constants)) > 0): @@ -613,7 +589,6 @@ def make_html_class(node): # ET.SubElement(div,"br") - descr = node.find("description") if (descr != None and descr.text.strip() != ""): h4 = ET.SubElement(div, "h4") @@ -624,8 +599,6 @@ def make_html_class(node): # div2.attrib["class"]="description"; # div2.text=descr.text - - if(methods != None or events != None): h4 = ET.SubElement(div, "h4") @@ -646,7 +619,6 @@ def make_html_class(node): div2 = ET.SubElement(div, "div") div2.attrib["class"] = "method_doc"; - div2.append(make_method_def(node.attrib["name"], m, True)) #anchor = ET.SubElement(div2, "a") # anchor.attrib["name"] = @@ -655,7 +627,6 @@ def make_html_class(node): # div3.attrib["class"]="description"; # div3.text=descr.text - return div class_names = [] @@ -688,7 +659,6 @@ if (not single_page): make_html_top(body) - class_names.sort() body.append(make_html_class_list(class_names, 5)) @@ -717,4 +687,3 @@ if (single_page): else: make_html_bottom(body) et_out.write("alphabetical.html") - diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py index 0693291f35f..bd0d4c6819f 100644 --- a/doc/tools/makemd.py +++ b/doc/tools/makemd.py @@ -343,4 +343,3 @@ make_class_list(class_names, 2) for cn in class_names: c = classes[cn] make_doku_class(c) - diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 2f3b9c269d1..6b6780ce1e4 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -24,6 +24,7 @@ def validate_tag(elem, tag): class_names = [] classes = {} + def ul_string(str, ul): str += "\n" for i in range(len(str) - 1): @@ -31,6 +32,7 @@ def ul_string(str, ul): str += "\n" return str + def make_class_list(class_list, columns): f = codecs.open('class_list.rst', 'wb', 'utf-8') @@ -343,7 +345,6 @@ def make_heading(title, underline): return title + '\n' + underline * len(title) + "\n\n" - def make_rst_class(node): name = node.attrib['name'] @@ -375,7 +376,6 @@ def make_rst_class(node): else: inh = None - f.write("\n\n") inherited = [] @@ -436,7 +436,6 @@ def make_rst_class(node): f.write(sep) f.write('\n') - events = node.find('signals') if events != None and len(list(events)) > 0: f.write(make_heading('Signals', '-')) @@ -516,4 +515,3 @@ class_names.sort() for cn in class_names: c = classes[cn] make_rst_class(c) - diff --git a/methods.py b/methods.py index 38dee11a353..269e076409a 100755 --- a/methods.py +++ b/methods.py @@ -1,5 +1,6 @@ import os + def add_source_files(self, sources, filetype, lib_env=None, shared=False): import glob; import string; @@ -27,7 +28,6 @@ def build_shader_header(target, source, env): name = name[name.rfind("\\") + 1:] name = name.replace(".", "_") - fs = open(str(x), "r") fd = open(str(x) + ".h", "w") fd.write("/* this file has been generated by SCons, do not edit! */\n") @@ -94,7 +94,6 @@ def build_glsl_header(filename): if (not ifdefline in conditionals): conditionals += [ifdefline] - import re if re.search(r"^\s*uniform", line): @@ -137,8 +136,6 @@ def build_glsl_header(filename): ubos += [(x, uboidx)] ubo_names += [x] - - else: uline = line.replace("uniform", ""); uline = uline.replace(";", ""); @@ -160,7 +157,6 @@ def build_glsl_header(filename): uline = uline.replace(";", ""); uline = uline[uline.find(" "):].strip() - if (uline.find("//") != -1): name, bind = uline.split("//") if (bind.find("attrib:") != -1): @@ -173,7 +169,6 @@ def build_glsl_header(filename): uline = uline.replace(";", ""); uline = uline[uline.find(" "):].strip() - if (uline.find("//") != -1): name, bind = uline.split("//") if (bind.find("drawbuffer:") != -1): @@ -330,7 +325,6 @@ def build_glsl_header(filename): fd.write("\n\n#undef _FU\n\n\n"); - fd.write("\tvirtual void init() {\n\n"); if (len(conditionals)): @@ -361,8 +355,6 @@ def build_glsl_header(filename): else: fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n") - - if (len(fbos)): fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n") for x in fbos: @@ -394,7 +386,6 @@ def build_glsl_header(filename): fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n") - fd.write("\t\tstatic const char* _fragment_code=\"\\\n") for x in fragment_lines: fd.write("\t\t\t" + x + "\n"); @@ -416,11 +407,9 @@ def build_glsl_headers(target, source, env): build_glsl_header(str(x)); - return 0 - def build_hlsl_dx9_header(filename): fs = open(filename, "r") @@ -527,7 +516,6 @@ def build_hlsl_dx9_header(filename): fd.write("\t\t" + x.upper() + ",\n"); fd.write("\t};\n\n"); - if (len(conditionals)): fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n"); @@ -597,7 +585,6 @@ def build_hlsl_dx9_header(filename): fd.write("\n\n#undef _FU\n\n\n"); - fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n"); if (len(conditionals)): @@ -630,7 +617,6 @@ def build_hlsl_dx9_header(filename): fd.write("\t\tstatic const char **_uniform_strings=NULL;\n") fd.write("\t\tstatic const bool *_fragment_uniforms=NULL;\n") - fd.write("\t\tstatic const char* _vertex_code=\"\\\n") for x in vertex_lines: fd.write("\t\t\t" + x + "\n"); @@ -638,7 +624,6 @@ def build_hlsl_dx9_header(filename): fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n") - fd.write("\t\tstatic const char* _fragment_code=\"\\\n") for x in fragment_lines: fd.write("\t\t\t" + x + "\n"); @@ -660,11 +645,11 @@ def build_hlsl_dx9_headers(target, source, env): build_hlsl_dx9_header(str(x)); - return 0 class LegacyGLHeaderStruct: + def __init__(self): self.vertex_lines = [] self.fragment_lines = [] @@ -686,6 +671,7 @@ class LegacyGLHeaderStruct: self.vertex_offset = 0 self.fragment_offset = 0 + def include_file_in_legacygl_header(filename, header_data, depth): fs = open(filename, "r") line = fs.readline() @@ -767,8 +753,6 @@ def include_file_in_legacygl_header(filename, header_data, depth): header_data.texunits += [(x, texunit)] header_data.texunit_names += [x] - - elif (line.find("uniform") != -1): uline = line.replace("uniform", ""); uline = uline.replace(";", ""); @@ -784,7 +768,6 @@ def include_file_in_legacygl_header(filename, header_data, depth): if (not x in header_data.uniforms): header_data.uniforms += [x] - if ((line.strip().find("in ") == 0 or line.strip().find("attribute ") == 0) and line.find("attrib:") != -1): uline = line.replace("in ", ""); uline = uline.replace("attribute ", ""); @@ -792,7 +775,6 @@ def include_file_in_legacygl_header(filename, header_data, depth): uline = uline.replace(";", ""); uline = uline[uline.find(" "):].strip() - if (uline.find("//") != -1): name, bind = uline.split("//") if (bind.find("attrib:") != -1): @@ -800,7 +782,6 @@ def include_file_in_legacygl_header(filename, header_data, depth): bind = bind.replace("attrib:", "").strip() header_data.attributes += [(name, bind)] - line = line.replace("\r", "") line = line.replace("\n", "") # line=line.replace("\\","\\\\") @@ -820,7 +801,6 @@ def include_file_in_legacygl_header(filename, header_data, depth): return header_data - def build_legacygl_header(filename, include, class_suffix, output_attribs): header_data = LegacyGLHeaderStruct() @@ -847,7 +827,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n"); fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n"); - fd.write("public:\n\n"); if (len(header_data.conditionals)): @@ -856,7 +835,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\t\t" + x.upper() + ",\n"); fd.write("\t};\n\n"); - if (len(header_data.uniforms)): fd.write("\tenum Uniforms {\n"); for x in header_data.uniforms: @@ -965,10 +943,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\n\n#undef _FU\n\n\n"); - fd.write("\tvirtual void init() {\n\n"); - enum_value_count = 0; if (len(header_data.enums)): @@ -1002,7 +978,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n"); bitofs += bits - fd.write("\t\t};\n\n"); fd.write("\t\tstatic const EnumValue _enum_values[]={\n") @@ -1046,7 +1021,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): else: fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n") - if (len(header_data.texunits)): fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n") for x in header_data.texunits: @@ -1065,7 +1039,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\t\tstatic const int _vertex_code_start=" + str(header_data.vertex_offset) + ";\n") - fd.write("\t\tstatic const char _fragment_code[]={\n") for x in header_data.fragment_lines: for i in range(len(x)): @@ -1083,7 +1056,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\t};\n\n") - if (len(enum_constants)): fd.write("\tenum EnumConditionals {\n") @@ -1092,7 +1064,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs): fd.write("\t};\n\n"); fd.write("\tvoid set_enum_conditional(EnumConditionals p_cond) { _set_enum_conditional(p_cond); }\n") - fd.write("};\n\n"); fd.write("#endif\n\n"); fd.close(); @@ -1104,14 +1075,15 @@ def build_legacygl_headers(target, source, env): build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False); - return 0 + def build_gles2_headers(target, source, env): for x in source: build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True) + def update_version(): rev = "custom_build" @@ -1121,7 +1093,6 @@ def update_version(): print("Using custom revision: " + rev) import version - f = open("core/version.h", "wb") f.write("#define VERSION_SHORT_NAME " + str(version.short_name) + "\n") f.write("#define VERSION_NAME " + str(version.name) + "\n") @@ -1134,6 +1105,7 @@ def update_version(): import datetime f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n") + def parse_cg_file(fname, uniforms, sizes, conditionals): import re @@ -1204,8 +1176,9 @@ def build_cg_shader(sname): fd.write("\t};\n"); - import glob + + def detect_modules(): module_list = [] @@ -1260,7 +1233,6 @@ void unregister_module_types() { return module_list - def win32_spawn(sh, escape, cmd, args, env): import subprocess newargs = ' '.join(args[1:]) @@ -1309,44 +1281,61 @@ def win32_spawn(sh, escape, cmd, args, spawnenv): return exit_code """ + def android_add_maven_repository(self, url): self.android_maven_repos.append(url) + def android_add_dependency(self, depline): self.android_dependencies.append(depline) + def android_add_java_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_java_dirs.append(base_path) + def android_add_res_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_res_dirs.append(base_path) + + def android_add_aidl_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_aidl_dirs.append(base_path) + + def android_add_jni_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_jni_dirs.append(base_path) + + def android_add_default_config(self, config): self.android_default_config.append(config) + def android_add_to_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_add_to_permissions(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_add_to_attributes(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) + def use_windows_spawn_fix(self, platform=None): if (os.name != "nt"): @@ -1503,6 +1492,7 @@ def no_verbose(sys, env): env.Append(JARCOMSTR=[java_library_message]) env.Append(JAVACCOMSTR=[java_compile_source_message]) + def detect_visual_c_compiler_version(tools_env): # tools_env is the variable scons uses to call tools that execute tasks, SCons's env['ENV'] that executes tasks... # (see the SCons documentation for more information on what it does)... @@ -1543,7 +1533,6 @@ def detect_visual_c_compiler_version(tools_env): vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index vc_chosen_compiler_str = "amd64_x86" - # Now check the 32 bit compilers vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;") if(vc_x86_compiler_detection_index > -1 diff --git a/modules/chibi/config.py b/modules/chibi/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/chibi/config.py +++ b/modules/chibi/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/cscript/config.py b/modules/cscript/config.py index ae0a3d75eed..5698a372954 100644 --- a/modules/cscript/config.py +++ b/modules/cscript/config.py @@ -6,6 +6,3 @@ def can_build(platform): def configure(env): pass - - - diff --git a/modules/dds/config.py b/modules/dds/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/dds/config.py +++ b/modules/dds/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/enet/config.py b/modules/enet/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/enet/config.py +++ b/modules/enet/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/etc1/config.py b/modules/etc1/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/etc1/config.py +++ b/modules/etc1/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/freetype/config.py b/modules/freetype/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/freetype/config.py +++ b/modules/freetype/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index ae0a3d75eed..5698a372954 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -6,6 +6,3 @@ def can_build(platform): def configure(env): pass - - - diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index ae0a3d75eed..5698a372954 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -6,6 +6,3 @@ def can_build(platform): def configure(env): pass - - - diff --git a/modules/ik/config.py b/modules/ik/config.py index ae0a3d75eed..5698a372954 100644 --- a/modules/ik/config.py +++ b/modules/ik/config.py @@ -6,6 +6,3 @@ def can_build(platform): def configure(env): pass - - - diff --git a/modules/jpg/config.py b/modules/jpg/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/jpg/config.py +++ b/modules/jpg/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/mpc/config.py b/modules/mpc/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/mpc/config.py +++ b/modules/mpc/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/ogg/config.py b/modules/ogg/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/ogg/config.py +++ b/modules/ogg/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/openssl/config.py b/modules/openssl/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/openssl/config.py +++ b/modules/openssl/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/opus/config.py b/modules/opus/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/opus/config.py +++ b/modules/opus/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/pbm/config.py b/modules/pbm/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/pbm/config.py +++ b/modules/pbm/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/pvr/config.py b/modules/pvr/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/pvr/config.py +++ b/modules/pvr/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/regex/config.py b/modules/regex/config.py index 667b5d8ba65..5347cfd2438 100644 --- a/modules/regex/config.py +++ b/modules/regex/config.py @@ -1,8 +1,9 @@ #!/usr/bin/env python + def can_build(platform): return True + def configure(env): pass - diff --git a/modules/squish/config.py b/modules/squish/config.py index 81e6163a9b2..cc8f0980103 100644 --- a/modules/squish/config.py +++ b/modules/squish/config.py @@ -2,6 +2,7 @@ def can_build(platform): return True + def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that diff --git a/modules/theora/config.py b/modules/theora/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/theora/config.py +++ b/modules/theora/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py index ae0a3d75eed..5698a372954 100644 --- a/modules/visual_script/config.py +++ b/modules/visual_script/config.py @@ -6,6 +6,3 @@ def can_build(platform): def configure(env): pass - - - diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/vorbis/config.py +++ b/modules/vorbis/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/webm/config.py b/modules/webm/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/webm/config.py +++ b/modules/webm/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/modules/webp/config.py b/modules/webp/config.py index 3de0425119c..fb920482f5f 100644 --- a/modules/webp/config.py +++ b/modules/webp/config.py @@ -2,5 +2,6 @@ def can_build(platform): return True + def configure(env): pass diff --git a/platform/android/detect.py b/platform/android/detect.py index f1331d24d5f..5de4f114451 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -3,12 +3,15 @@ import sys import string import platform + def is_active(): return True + def get_name(): return "Android" + def can_build(): import os @@ -17,6 +20,7 @@ def can_build(): return True + def get_opts(): return [ @@ -47,6 +51,7 @@ def create(env): env.Tool('gcc') return env.Clone(tools=tools); + def configure(env): # Workaround for MinGW. See: @@ -102,7 +107,6 @@ def configure(env): env.Tool('gcc') env['SHLIBSUFFIX'] = '.so' - neon_text = "" if env["android_arch"] == "armv7" and env['android_neon'] == 'yes': neon_text = " (with neon)" @@ -241,7 +245,6 @@ def configure(env): env.Append(LIBS=['gnustl_static']) env.Append(CCFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST']) - import methods env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')}) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')}) diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py index ed320bebc17..95720794b2b 100644 --- a/platform/bb10/detect.py +++ b/platform/bb10/detect.py @@ -7,9 +7,11 @@ import methods def is_active(): return True + def get_name(): return "BlackBerry 10" + def can_build(): import os @@ -17,6 +19,7 @@ def can_build(): return False return True + def get_opts(): return [ @@ -29,6 +32,7 @@ def get_opts(): ('bb10_exceptions', 'Use exceptions when compiling on bb10', 'no'), ] + def get_flags(): return [ @@ -37,6 +41,7 @@ def get_flags(): ('module_theora_enabled', 'no'), ] + def configure(env): if env['PLATFORM'] == 'win32': @@ -86,4 +91,3 @@ def configure(env): env.Append(LINKFLAGS=['-g']) env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound']) - diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub index 23e5e2e7119..d0c244a1945 100644 --- a/platform/haiku/SCsub +++ b/platform/haiku/SCsub @@ -20,6 +20,7 @@ target = env.Program( command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef', ['rc -o $TARGET $SOURCE']) + def addResourcesAction(target=None, source=None, env=None): return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc') diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index e64be0a188f..71202a9a495 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -1,12 +1,15 @@ import os import sys + def is_active(): return True + def get_name(): return "Haiku" + def can_build(): if (os.name != "posix"): return False @@ -16,15 +19,18 @@ def can_build(): return True + def get_opts(): return [ ('debug_release', 'Add debug symbols to release version', 'no') ] + def get_flags(): return [ ] + def configure(env): is64 = sys.maxsize > 2**32 diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 541487d5868..229038697c2 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -5,9 +5,11 @@ import sys def is_active(): return True + def get_name(): return "iOS" + def can_build(): import sys @@ -17,6 +19,7 @@ def can_build(): return False + def get_opts(): return [ @@ -33,6 +36,7 @@ def get_opts(): ('ios_sim', 'Build simulator binary', 'no'), ] + def get_flags(): return [ @@ -43,7 +47,6 @@ def get_flags(): ] - def configure(env): env.Append(CPPPATH=['#platform/iphone']) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 56b41a49aca..04a6bc9cc3c 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -2,12 +2,15 @@ import os import sys import string + def is_active(): return True + def get_name(): return "JavaScript" + def can_build(): import os @@ -15,6 +18,7 @@ def can_build(): return False return True + def get_opts(): return [ @@ -22,6 +26,7 @@ def get_opts(): ['javascript_eval', 'Enable JavaScript eval interface', 'yes'], ] + def get_flags(): return [ @@ -33,7 +38,6 @@ def get_flags(): ] - def configure(env): env['ENV'] = os.environ; env.use_windows_spawn_fix('javascript') diff --git a/platform/osx/detect.py b/platform/osx/detect.py index ddb27742a0a..9191f1aabca 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -6,17 +6,19 @@ import sys def is_active(): return True + def get_name(): return "OSX" + def can_build(): if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")): return True - return False + def get_opts(): return [ @@ -25,13 +27,13 @@ def get_opts(): ] + def get_flags(): return [ ] - def configure(env): env.Append(CPPPATH=['#platform/osx']) @@ -51,8 +53,6 @@ def configure(env): env.Append(CCFLAGS=['-g3', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) - - if (not os.environ.has_key("OSXCROSS_ROOT")): # regular native build if (env["bits"] == "64"): @@ -72,14 +72,12 @@ def configure(env): else: basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-" - env['CC'] = basecmd + "cc" env['CXX'] = basecmd + "c++" env['AR'] = basecmd + "ar" env['RANLIB'] = basecmd + "ranlib" env['AS'] = basecmd + "as" - env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"]) env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED']) env.Append(LIBS=['pthread']) diff --git a/platform/server/detect.py b/platform/server/detect.py index 9d23ceda706..b367e1f2c31 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -6,6 +6,7 @@ import sys def is_active(): return True + def get_name(): return "Server" @@ -17,6 +18,7 @@ def can_build(): return True # enabled + def get_opts(): return [ @@ -24,13 +26,13 @@ def get_opts(): ('force_32_bits', 'Force 32 bits binary', 'no') ] + def get_flags(): return [ ] - def configure(env): env.Append(CPPPATH=['#platform/server']) @@ -47,13 +49,11 @@ def configure(env): else: env["bits"] = "32" - # if (env["tools"]=="no"): # #no tools suffix # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX'] # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX'] - if (env["target"] == "release"): env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer']) @@ -73,4 +73,3 @@ def configure(env): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env["CC"] = "clang" env["LD"] = "clang++" - diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 4bb6dc4a966..93d29a36066 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -99,12 +99,15 @@ import sys import methods + def is_active(): return True + def get_name(): return "Windows" + def can_build(): if (os.name == "nt"): @@ -148,6 +151,7 @@ def can_build(): return False + def get_opts(): mingw = "" @@ -167,12 +171,12 @@ def get_opts(): if (os.getenv("MINGW64_PREFIX")): mingw64 = os.getenv("MINGW64_PREFIX") - return [ ('mingw_prefix', 'Mingw Prefix', mingw32), ('mingw_prefix_64', 'Mingw Prefix 64 bits', mingw64), ] + def get_flags(): return [ @@ -180,6 +184,7 @@ def get_flags(): ('openssl', 'builtin'), # use builtin openssl ] + def build_res_file(target, source, env): cmdbase = "" @@ -200,6 +205,7 @@ def build_res_file(target, source, env): return 1 return 0 + def configure(env): env.Append(CPPPATH=['#platform/windows']) @@ -210,7 +216,6 @@ def configure(env): env.Append(CPPPATH=['#platform/windows/include']) env.Append(LIBPATH=['#platform/windows/lib']) - if (env["target"] == "release"): env.Append(CCFLAGS=['/O2']) @@ -234,7 +239,6 @@ def configure(env): env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/DEBUG']) - env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo']) env.Append(CXXFLAGS=['/TP']) env.Append(CPPFLAGS=['/DMSVC', '/GR', ]) @@ -331,8 +335,6 @@ def configure(env): else: nulstr = ">nul" - - # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0: # #not really super consistent but.. # print("Can't find Windows compiler: "+mingw_prefix) @@ -357,8 +359,6 @@ def configure(env): env.Append(CCFLAGS=['-g', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) - - env["CC"] = mingw_prefix + "gcc" env['AS'] = mingw_prefix + "as" env['CXX'] = mingw_prefix + "g++" @@ -381,9 +381,6 @@ def configure(env): # env.Append(CPPFLAGS=['-march=i686']) # env.Append(LINKFLAGS=['-march=i686']) - - - #'d3dx9d' env.Append(CPPFLAGS=['-DMINGW_ENABLED']) # env.Append(LINKFLAGS=['-g']) diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py index 19a6324e1e8..15ac429687d 100644 --- a/platform/winrt/detect.py +++ b/platform/winrt/detect.py @@ -8,9 +8,11 @@ import methods def is_active(): return True + def get_name(): return "WinRT" + def can_build(): if (os.name == "nt"): # building natively on windows! @@ -22,9 +24,11 @@ def can_build(): return True return False + def get_opts(): return [] + def get_flags(): return [ @@ -129,12 +133,10 @@ def configure(env): env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/DEBUG']) - env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo')) env.Append(CXXFLAGS=string.split('/ZW /FS')) env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral']) - env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"] env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"] env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"] diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 37c787179fe..935a9fcc26c 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -7,6 +7,7 @@ import platform def is_active(): return True + def get_name(): return "X11" @@ -50,9 +51,9 @@ def can_build(): print("xrandr not found.. x11 disabled.") return False - return True # X11 enabled + def get_opts(): return [ @@ -65,6 +66,7 @@ def get_opts(): ('debug_release', 'Add debug symbols to release version', 'no'), ] + def get_flags(): return [ @@ -74,7 +76,6 @@ def get_flags(): ] - def configure(env): is64 = sys.maxsize > 2**32 @@ -104,13 +105,11 @@ def configure(env): env.Append(LINKFLAGS=['-fsanitize=address']) env.extra_suffix += "s" - # if (env["tools"]=="no"): # #no tools suffix # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX'] # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX'] - if (env["target"] == "release"): if (env["debug_release"] == "yes"): @@ -174,7 +173,6 @@ def configure(env): if (env["libogg"] == "system"): env.ParseConfig('pkg-config ogg --cflags --libs') - env.Append(CPPFLAGS=['-DOPENGL_ENABLED']) if (env["glew"] == "system"): @@ -223,7 +221,6 @@ def configure(env): env.Append(CPPFLAGS=['-m64']) env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu']) - import methods env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')}) @@ -237,4 +234,3 @@ def configure(env): list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] if any(platform.machine() in s for s in list_of_x86): env["x86_libtheora_opt_gcc"] = True - diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py index d8799fd7da7..41d5e2e259b 100644 --- a/scene/resources/default_theme/make_header.py +++ b/scene/resources/default_theme/make_header.py @@ -54,7 +54,6 @@ for x in shaders: sf = open(x, "rb"); - b = sf.readline(); while(b != ""): if (b.endswith("\r\n")): diff --git a/tools/SCsub b/tools/SCsub index 87ed836ae05..f11aa34ee69 100644 --- a/tools/SCsub +++ b/tools/SCsub @@ -10,12 +10,10 @@ Export('env') def make_translations_header(target, source, env): - dst = target[0].srcnode().abspath g = open(dst, "wb") - """" """ @@ -65,12 +63,10 @@ def make_translations_header(target, source, env): def make_fonts_header(target, source, env): - dst = target[0].srcnode().abspath g = open(dst, "wb") - """" """ diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 0dbb7d3f206..625103eaeea 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -14,7 +14,6 @@ def make_doc_header(target, source, env): import zlib buf = zlib.compress(buf) - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _DOC_DATA_RAW_H\n") g.write("#define _DOC_DATA_RAW_H\n") @@ -27,7 +26,6 @@ def make_doc_header(target, source, env): g.write("#endif") - def make_certs_header(target, source, env): src = source[0].srcnode().abspath @@ -39,7 +37,6 @@ def make_certs_header(target, source, env): import zlib buf = zlib.compress(buf) - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _CERTS_RAW_H\n") g.write("#define _CERTS_RAW_H\n") @@ -52,11 +49,6 @@ def make_certs_header(target, source, env): g.write("#endif") - - - - - if (env["tools"] == "yes"): reg_exporters_inc = '#include "register_exporters.h"\n' diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index ac942b20e36..f27350a1841 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -2,6 +2,7 @@ Import('env') + def make_editor_icons_action(target, source, env): import os @@ -58,9 +59,6 @@ def make_editor_icons_action(target, source, env): except: s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n"); - - - s.write("static Ref make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef texture( memnew( ImageTexture ) );\n") s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") diff --git a/tools/scripts/addheader.py b/tools/scripts/addheader.py index 573d5182f58..7838e16ae0c 100644 --- a/tools/scripts/addheader.py +++ b/tools/scripts/addheader.py @@ -56,7 +56,6 @@ while (fname != ""): else: text = header.replace("$filename", fsingle) - while (l != ""): if ((l.find("//") != 0 and l.find("/*") != 0 and l.strip() != "") or bc): text += l @@ -69,4 +68,3 @@ while (fname != ""): fr.close() # print(text) fname = f.readline() - diff --git a/tools/scripts/file-hex-array.py b/tools/scripts/file-hex-array.py index 8b7c3edd7fb..da95c9505f8 100755 --- a/tools/scripts/file-hex-array.py +++ b/tools/scripts/file-hex-array.py @@ -2,6 +2,7 @@ import binascii import os.path import sys + def tof(filepath): with open(filepath, 'r') as f: content = f.read() @@ -15,6 +16,7 @@ def tof(filepath): print(os.path.basename(filepath) + ".file created.") exit(0) + def toa(filepath): with open(filepath, 'rb') as f: content = f.read() @@ -28,6 +30,7 @@ def toa(filepath): print(os.path.basename(filepath) + ".array created.") exit(0) + def usage(): print("========================================================\n\ #\n\ diff --git a/tools/scripts/make_bmfhdr.py b/tools/scripts/make_bmfhdr.py index e6aa43f6bbb..1d3c40f9c6d 100644 --- a/tools/scripts/make_bmfhdr.py +++ b/tools/scripts/make_bmfhdr.py @@ -33,7 +33,6 @@ while(l != ""): s = x.split("=") d[s[0]] = s[1] - if (t == "common"): font_height = d["lineHeight"] font_ascent = d["base"] @@ -49,8 +48,6 @@ while(l != ""): font_chars.append(d["xadvance"]) font_cc += 1 - - l = f.readline() diff --git a/tools/scripts/make_glwrapper.py b/tools/scripts/make_glwrapper.py index 9f26f8430e5..bae0eeeadc9 100644 --- a/tools/scripts/make_glwrapper.py +++ b/tools/scripts/make_glwrapper.py @@ -87,7 +87,6 @@ for x in (range(len(sys.argv) - 1)): print(funcdata) - # print(types) # print(constants) # print(functions) @@ -177,7 +176,3 @@ for x in functions: f.write("\n\n") f.write("}\n") f.write("\n\n") - - - - diff --git a/tools/scripts/makeargs.py b/tools/scripts/makeargs.py index a52812eaff2..2cd47ae087d 100644 --- a/tools/scripts/makeargs.py +++ b/tools/scripts/makeargs.py @@ -64,7 +64,6 @@ text = """ """ - for i in range(1, 8): tp = "" @@ -81,8 +80,3 @@ for i in range(1, 8): t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i)) print(t) - - - - - diff --git a/tools/scripts/svgs_2_pngs.py b/tools/scripts/svgs_2_pngs.py index b55fd97d0aa..b24324dcd7e 100644 --- a/tools/scripts/svgs_2_pngs.py +++ b/tools/scripts/svgs_2_pngs.py @@ -73,7 +73,6 @@ def export_icons(): svg_to_png(source_path, theme_dir_base + theme_out_icon_name, 90) - def export_theme(): svgs_path = theme_dir_source file_names = [f for f in listdir(svgs_path) if isfile(join(svgs_path, f))]