class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@@ -77,7 +77,7 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
#endif
"""
-template="""
+template = """
#ifndef TYPED_METHOD_BIND
$iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@@ -166,96 +166,96 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
"""
-def make_version(template,nargs,argmax,const,ret):
+def make_version(template, nargs, argmax, const, ret):
- intext=template
- from_pos=0
- outtext=""
+ intext = template
+ from_pos = 0
+ outtext = ""
while(True):
- to_pos=intext.find("$",from_pos)
- if (to_pos==-1):
- outtext+=intext[from_pos:]
+ to_pos = intext.find("$", from_pos)
+ if (to_pos == -1):
+ outtext += intext[from_pos:]
break
else:
- outtext+=intext[from_pos:to_pos]
- end=intext.find("$",to_pos+1)
- if (end==-1):
- break # ignore
- macro=intext[to_pos+1:end]
- cmd=""
- data=""
-
- if (macro.find(" ")!=-1):
- cmd=macro[0:macro.find(" ")]
- data=macro[macro.find(" ")+1:]
+ outtext += intext[from_pos:to_pos]
+ end = intext.find("$", to_pos + 1)
+ if (end == -1):
+ break # ignore
+ macro = intext[to_pos + 1:end]
+ cmd = ""
+ data = ""
+
+ if (macro.find(" ") != -1):
+ cmd = macro[0:macro.find(" ")]
+ data = macro[macro.find(" ") + 1:]
else:
- cmd=macro
-
- if (cmd=="argc"):
- outtext+=str(nargs)
- if (cmd=="ifret" and ret):
- outtext+=data
- if (cmd=="ifargs" and nargs):
- outtext+=data
- if (cmd=="ifretargs" and nargs and ret):
- outtext+=data
- if (cmd=="ifconst" and const):
- outtext+=data
- elif (cmd=="ifnoconst" and not const):
- outtext+=data
- elif (cmd=="ifnoret" and not ret):
- outtext+=data
- elif (cmd=="iftempl" and (nargs>0 or ret)):
- outtext+=data
- elif (cmd=="arg,"):
- for i in range(1,nargs+1):
- if (i>1):
- outtext+=", "
- outtext+=data.replace("@",str(i))
- elif (cmd=="arg"):
- for i in range(1,nargs+1):
- outtext+=data.replace("@",str(i))
- elif (cmd=="noarg"):
- for i in range(nargs+1,argmax+1):
- outtext+=data.replace("@",str(i))
- elif (cmd=="noarg"):
- for i in range(nargs+1,argmax+1):
- outtext+=data.replace("@",str(i))
-
- from_pos=end+1
+ cmd = macro
+
+ if (cmd == "argc"):
+ outtext += str(nargs)
+ if (cmd == "ifret" and ret):
+ outtext += data
+ if (cmd == "ifargs" and nargs):
+ outtext += data
+ if (cmd == "ifretargs" and nargs and ret):
+ outtext += data
+ if (cmd == "ifconst" and const):
+ outtext += data
+ elif (cmd == "ifnoconst" and not const):
+ outtext += data
+ elif (cmd == "ifnoret" and not ret):
+ outtext += data
+ elif (cmd == "iftempl" and (nargs > 0 or ret)):
+ outtext += data
+ elif (cmd == "arg,"):
+ for i in range(1, nargs + 1):
+ if (i > 1):
+ outtext += ", "
+ outtext += data.replace("@", str(i))
+ elif (cmd == "arg"):
+ for i in range(1, nargs + 1):
+ outtext += data.replace("@", str(i))
+ elif (cmd == "noarg"):
+ for i in range(nargs + 1, argmax + 1):
+ outtext += data.replace("@", str(i))
+ elif (cmd == "noarg"):
+ for i in range(nargs + 1, argmax + 1):
+ outtext += data.replace("@", str(i))
+
+ from_pos = end + 1
return outtext
def run(target, source, env):
- versions=10
- versions_ext=6
- text=""
- text_ext=""
-
- for i in range(0,versions+1):
-
- t=""
- t+=make_version(template,i,versions,False,False)
- t+=make_version(template_typed,i,versions,False,False)
- t+=make_version(template,i,versions,False,True)
- t+=make_version(template_typed,i,versions,False,True)
- t+=make_version(template,i,versions,True,False)
- t+=make_version(template_typed,i,versions,True,False)
- t+=make_version(template,i,versions,True,True)
- t+=make_version(template_typed,i,versions,True,True)
- if (i>=versions_ext):
- text_ext+=t
+ versions = 10
+ versions_ext = 6
+ text = ""
+ text_ext = ""
+
+ for i in range(0, versions + 1):
+
+ t = ""
+ t += make_version(template, i, versions, False, False)
+ t += make_version(template_typed, i, versions, False, False)
+ t += make_version(template, i, versions, False, True)
+ t += make_version(template_typed, i, versions, False, True)
+ t += make_version(template, i, versions, True, False)
+ t += make_version(template_typed, i, versions, True, False)
+ t += make_version(template, i, versions, True, True)
+ t += make_version(template_typed, i, versions, True, True)
+ if (i >= versions_ext):
+ text_ext += t
else:
- text+=t
+ text += t
- f=open(target[0].path,"w")
+ f = open(target[0].path, "w")
f.write(text)
f.close()
- f=open(target[1].path,"w")
+ f = open(target[1].path, "w")
f.write(text_ext)
f.close()
diff --git a/core/math/SCsub b/core/math/SCsub
index c2731d60e..4efc90271 100644
--- a/core/math/SCsub
+++ b/core/math/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
Export('env')
diff --git a/core/os/SCsub b/core/os/SCsub
index c2731d60e..4efc90271 100644
--- a/core/os/SCsub
+++ b/core/os/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
Export('env')
diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py
index 27f46960b..747a87037 100644
--- a/doc/tools/doc_merge.py
+++ b/doc/tools/doc_merge.py
@@ -6,17 +6,17 @@ import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1])
-old_doc=tree.getroot()
+old_doc = tree.getroot()
tree = ET.parse(sys.argv[2])
-new_doc=tree.getroot()
+new_doc = tree.getroot()
-f = file(sys.argv[3],"wb")
-tab=0
+f = file(sys.argv[3], "wb")
+tab = 0
-old_classes={}
+old_classes = {}
-def write_string(_f, text,newline=True):
+def write_string(_f, text, newline=True):
for t in range(tab):
_f.write("\t")
_f.write(text)
@@ -24,188 +24,188 @@ def write_string(_f, text,newline=True):
_f.write("\n")
def escape(ret):
- ret=ret.replace("&","&");
- ret=ret.replace("<",">");
- ret=ret.replace(">","<");
- ret=ret.replace("'","'");
- ret=ret.replace("\"",""");
+ ret = ret.replace("&", "&");
+ ret = ret.replace("<", ">");
+ ret = ret.replace(">", "<");
+ ret = ret.replace("'", "'");
+ ret = ret.replace("\"", """);
return ret
def inc_tab():
global tab
- tab+=1
+ tab += 1
def dec_tab():
global tab
- tab-=1
+ tab -= 1
-write_string(f,'')
-write_string(f,'')
+write_string(f, '')
+write_string(f, '')
-def get_tag(node,name):
- tag=""
+def get_tag(node, name):
+ tag = ""
if (name in node.attrib):
- tag=' '+name+'="'+escape(node.attrib[name])+'" '
+ tag = ' ' + name + '="' + escape(node.attrib[name]) + '" '
return tag
-def find_method_descr(old_class,name):
+def find_method_descr(old_class, name):
methods = old_class.find("methods")
- if(methods!=None and len(list(methods))>0):
+ if(methods != None and len(list(methods)) > 0):
for m in list(methods):
- if (m.attrib["name"]==name):
- description=m.find("description")
- if (description!=None and description.text.strip()!=""):
+ if (m.attrib["name"] == name):
+ description = m.find("description")
+ if (description != None and description.text.strip() != ""):
return description.text
return None
-def find_signal_descr(old_class,name):
+def find_signal_descr(old_class, name):
signals = old_class.find("signals")
- if(signals!=None and len(list(signals))>0):
+ if(signals != None and len(list(signals)) > 0):
for m in list(signals):
- if (m.attrib["name"]==name):
- description=m.find("description")
- if (description!=None and description.text.strip()!=""):
+ if (m.attrib["name"] == name):
+ description = m.find("description")
+ if (description != None and description.text.strip() != ""):
return description.text
return None
-def find_constant_descr(old_class,name):
+def find_constant_descr(old_class, name):
- if (old_class==None):
+ if (old_class == None):
return None
constants = old_class.find("constants")
- if(constants!=None and len(list(constants))>0):
+ if(constants != None and len(list(constants)) > 0):
for m in list(constants):
- if (m.attrib["name"]==name):
- if (m.text.strip()!=""):
+ if (m.attrib["name"] == name):
+ if (m.text.strip() != ""):
return m.text
return None
def write_class(c):
class_name = c.attrib["name"]
- print("Parsing Class: "+class_name)
+ print("Parsing Class: " + class_name)
if (class_name in old_classes):
- old_class=old_classes[class_name]
+ old_class = old_classes[class_name]
else:
- old_class=None
+ old_class = None
- category=get_tag(c,"category")
- inherits=get_tag(c,"inherits")
- write_string(f,'')
+ category = get_tag(c, "category")
+ inherits = get_tag(c, "inherits")
+ write_string(f, '')
inc_tab()
- write_string(f,"")
+ write_string(f, "")
- if (old_class!=None):
- old_brief_descr=old_class.find("brief_description")
- if (old_brief_descr!=None):
- write_string(f,escape(old_brief_descr.text.strip()))
+ if (old_class != None):
+ old_brief_descr = old_class.find("brief_description")
+ if (old_brief_descr != None):
+ write_string(f, escape(old_brief_descr.text.strip()))
- write_string(f,"")
+ write_string(f, "")
- write_string(f,"")
- if (old_class!=None):
- old_descr=old_class.find("description")
- if (old_descr!=None):
- write_string(f,escape(old_descr.text.strip()))
+ write_string(f, "")
+ if (old_class != None):
+ old_descr = old_class.find("description")
+ if (old_descr != None):
+ write_string(f, escape(old_descr.text.strip()))
- write_string(f,"")
+ write_string(f, "")
methods = c.find("methods")
- if(methods!=None and len(list(methods))>0):
+ if(methods != None and len(list(methods)) > 0):
- write_string(f,"")
+ write_string(f, "")
inc_tab()
for m in list(methods):
- qualifiers=get_tag(m,"qualifiers")
+ qualifiers = get_tag(m, "qualifiers")
- write_string(f,'')
+ write_string(f, '')
inc_tab()
for a in list(m):
- if (a.tag=="return"):
- typ=get_tag(a,"type")
- write_string(f,'');
- write_string(f,'');
- elif (a.tag=="argument"):
+ if (a.tag == "return"):
+ typ = get_tag(a, "type")
+ write_string(f, '');
+ write_string(f, '');
+ elif (a.tag == "argument"):
- default=get_tag(a,"default")
+ default = get_tag(a, "default")
- write_string(f,'');
- write_string(f,'');
+ write_string(f, '');
+ write_string(f, '');
- write_string(f,'');
- if (old_class!=None):
- old_method_descr=find_method_descr(old_class,m.attrib["name"])
+ write_string(f, '');
+ if (old_class != None):
+ old_method_descr = find_method_descr(old_class, m.attrib["name"])
if (old_method_descr):
- write_string(f,escape(escape(old_method_descr.strip())))
+ write_string(f, escape(escape(old_method_descr.strip())))
- write_string(f,'');
+ write_string(f, '');
dec_tab()
- write_string(f,"")
+ write_string(f, "")
dec_tab()
- write_string(f,"")
+ write_string(f, "")
signals = c.find("signals")
- if(signals!=None and len(list(signals))>0):
+ if(signals != None and len(list(signals)) > 0):
- write_string(f,"")
+ write_string(f, "")
inc_tab()
for m in list(signals):
- write_string(f,'')
+ write_string(f, '')
inc_tab()
for a in list(m):
- if (a.tag=="argument"):
+ if (a.tag == "argument"):
- write_string(f,'');
- write_string(f,'');
+ write_string(f, '');
+ write_string(f, '');
- write_string(f,'');
- if (old_class!=None):
- old_signal_descr=find_signal_descr(old_class,m.attrib["name"])
+ write_string(f, '');
+ if (old_class != None):
+ old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
if (old_signal_descr):
- write_string(f,escape(old_signal_descr.strip()))
- write_string(f,'');
+ write_string(f, escape(old_signal_descr.strip()))
+ write_string(f, '');
dec_tab()
- write_string(f,"")
+ write_string(f, "")
dec_tab()
- write_string(f,"")
+ write_string(f, "")
constants = c.find("constants")
- if(constants!=None and len(list(constants))>0):
+ if(constants != None and len(list(constants)) > 0):
- write_string(f,"")
+ write_string(f, "")
inc_tab()
for m in list(constants):
- write_string(f,'')
- old_constant_descr=find_constant_descr(old_class,m.attrib["name"])
+ write_string(f, '')
+ old_constant_descr = find_constant_descr(old_class, m.attrib["name"])
if (old_constant_descr):
- write_string(f,escape(old_constant_descr.strip()))
- write_string(f,"")
+ write_string(f, escape(old_constant_descr.strip()))
+ write_string(f, "")
dec_tab()
- write_string(f,"")
+ write_string(f, "")
dec_tab()
- write_string(f,"")
+ write_string(f, "")
for c in list(old_doc):
- old_classes[c.attrib["name"]]=c
+ old_classes[c.attrib["name"]] = c
for c in list(new_doc):
write_class(c)
-write_string(f,'\n')
+write_string(f, '\n')
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index 00907bb01..4e108f352 100755
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -11,7 +11,7 @@ import xml.etree.ElementTree as ET
################################################################################
flags = {
- 'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
+ 'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
'b': False,
'g': False,
's': False,
@@ -62,15 +62,15 @@ long_flags = {
table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
colors = {
- 'name': [36], # cyan
- 'part_big_problem': [4, 31], # underline, red
- 'part_problem': [31], # red
- 'part_mostly_good': [33], # yellow
- 'part_good': [32], # green
- 'url': [4, 34], # underline, blue
- 'section': [1, 4], # bold, underline
- 'state_off': [36], # cyan
- 'state_on': [1, 35], # bold, magenta/plum
+ 'name': [36], # cyan
+ 'part_big_problem': [4, 31], # underline, red
+ 'part_problem': [31], # red
+ 'part_mostly_good': [33], # yellow
+ 'part_good': [32], # green
+ 'url': [4, 34], # underline, blue
+ 'section': [1, 4], # bold, underline
+ 'state_off': [36], # cyan
+ 'state_on': [1, 35], # bold, magenta/plum
}
overall_progress_description_weigth = 10
@@ -105,7 +105,7 @@ def nonescape_len(s):
################################################################################
class ClassStatusProgress:
- def __init__(self, described = 0, total = 0):
+ def __init__(self, described=0, total=0):
self.described = described
self.total = total
@@ -127,12 +127,12 @@ class ClassStatusProgress:
return self.to_colored_string()
def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
- ratio = self.described/self.total if self.total != 0 else 1
- percent = round(100*ratio)
- s = format.format(has = str(self.described), total = str(self.total), percent = str(percent))
+ ratio = self.described / self.total if self.total != 0 else 1
+ percent = round(100 * ratio)
+ s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
if self.described >= self.total:
s = color('part_good', s)
- elif self.described >= self.total/4*3:
+ elif self.described >= self.total / 4 * 3:
s = color('part_mostly_good', s)
elif self.described > 0:
s = color('part_problem', s)
@@ -142,7 +142,7 @@ class ClassStatusProgress:
pad_described = ''.ljust(pad_size - len(str(self.described)))
pad_percent = ''.ljust(3 - len(str(percent)))
pad_total = ''.ljust(pad_size - len(str(self.total)))
- return pad_format.format(pad_described = pad_described, pad_total = pad_total, pad_percent = pad_percent, s = s)
+ return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s)
class ClassStatus:
@@ -231,7 +231,7 @@ class ClassStatus:
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
elif tag.tag in ['theme_items']:
- pass #Ignore those tags, since they seem to lack description at all
+ pass # Ignore those tags, since they seem to lack description at all
else:
print(tag.tag, tag.attrib)
@@ -296,10 +296,10 @@ if len(input_file_list) < 1 or flags['h']:
if long_flags[synonym] == flag:
synonyms.append(color('name', '--' + synonym))
- print(('{synonyms} (Currently '+color('state_'+('on' if flags[flag] else 'off'), '{value}')+')\n\t{description}').format(
- synonyms = ', '.join(synonyms),
- value = ('on' if flags[flag] else 'off'),
- description = flag_descriptions[flag]
+ print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format(
+ synonyms=', '.join(synonyms),
+ value=('on' if flags[flag] else 'off'),
+ description=flag_descriptions[flag]
))
sys.exit(0)
@@ -413,9 +413,9 @@ for row_i, row in enumerate(table):
for cell_i, cell in enumerate(row):
padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
if cell_i == 0:
- row_string += table_row_chars[2] + cell + table_row_chars[2]*(padding_needed-1)
+ row_string += table_row_chars[2] + cell + table_row_chars[2] * (padding_needed - 1)
else:
- row_string += table_row_chars[2]*math.floor(padding_needed/2) + cell + table_row_chars[2]*math.ceil((padding_needed/2))
+ row_string += table_row_chars[2] * math.floor(padding_needed / 2) + cell + table_row_chars[2] * math.ceil((padding_needed / 2))
row_string += table_column_chars
print(row_string)
diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py
index f00a4614d..32a52a584 100644
--- a/doc/tools/makedoku.py
+++ b/doc/tools/makedoku.py
@@ -15,68 +15,68 @@ if len(input_list) < 1:
sys.exit(0)
-def validate_tag(elem,tag):
+def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '"+tag+"', got "+elem.tag);
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
sys.exit(255)
-class_names=[]
-classes={}
+class_names = []
+classes = {}
-def make_class_list(class_list,columns):
+def make_class_list(class_list, columns):
- f=open("class_list.txt","wb")
- prev=0
+ f = open("class_list.txt", "wb")
+ prev = 0
col_max = len(class_list) / columns + 1
print("col max is ", col_max)
col_count = 0
row_count = 0
last_initial = ""
- fit_columns=[]
+ fit_columns = []
- for n in range(0,columns):
- fit_columns+=[[]]
+ for n in range(0, columns):
+ fit_columns += [[]]
- indexers=[]
- last_initial=""
+ indexers = []
+ last_initial = ""
- idx=0
+ idx = 0
for n in class_list:
- col = idx/col_max
- if (col>=columns):
- col=columns-1
- fit_columns[col]+=[n]
- idx+=1
- if (n[:1]!=last_initial):
- indexers+=[n]
- last_initial=n[:1]
+ col = idx / col_max
+ if (col >= columns):
+ col = columns - 1
+ fit_columns[col] += [n]
+ idx += 1
+ if (n[:1] != last_initial):
+ indexers += [n]
+ last_initial = n[:1]
- row_max=0
+ row_max = 0
- for n in range(0,columns):
- if (len(fit_columns[n])>row_max):
- row_max=len(fit_columns[n])
+ 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):
- if (r>=len(fit_columns[c])):
+ for r in range(0, row_max):
+ s = "|"
+ for c in range(0, columns):
+ if (r >= len(fit_columns[c])):
continue
classname = fit_columns[c][r]
- initial=classname[0]
+ initial = classname[0]
if (classname in indexers):
- s+="**"+initial+"**|"
+ s += "**" + initial + "**|"
else:
- s+=" |"
+ s += " |"
- s+="[["+classname.lower()+"|"+classname+"]]|"
+ s += "[[" + classname.lower() + "|" + classname + "]]|"
- s+="\n"
+ s += "\n"
f.write(s)
@@ -86,221 +86,221 @@ def dokuize_text(txt):
def dokuize_text(text):
- pos=0
+ pos = 0
while(True):
- pos = text.find("[",pos)
- if (pos==-1):
+ pos = text.find("[", pos)
+ if (pos == -1):
break
- endq_pos=text.find("]",pos+1)
- if (endq_pos==-1):
+ endq_pos = text.find("]", pos + 1)
+ if (endq_pos == -1):
break
- pre_text=text[:pos]
- post_text=text[endq_pos+1:]
- tag_text=text[pos+1:endq_pos]
+ pre_text = text[:pos]
+ post_text = text[endq_pos + 1:]
+ tag_text = text[pos + 1:endq_pos]
if (tag_text in class_names):
- tag_text="[["+tag_text.lower()+"|"+tag_text+"]]"
- else: #command
- cmd=tag_text
- space_pos=tag_text.find(" ")
- if (cmd.find("html")==0):
- cmd=tag_text[:space_pos]
- param=tag_text[space_pos+1:]
- tag_text="<"+param+">"
- elif(cmd.find("method")==0):
- cmd=tag_text[:space_pos]
- param=tag_text[space_pos+1:]
-
- if (param.find(".")!=-1):
- class_param,method_param=param.split(".")
- tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]"
+ tag_text = "[[" + tag_text.lower() + "|" + tag_text + "]]"
+ else: # command
+ cmd = tag_text
+ space_pos = tag_text.find(" ")
+ if (cmd.find("html") == 0):
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+ tag_text = "<" + param + ">"
+ elif(cmd.find("method") == 0):
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+
+ if (param.find(".") != -1):
+ class_param, method_param = param.split(".")
+ tag_text = "[[" + class_param.lower() + "#" + method_param + "|" + class_param + '.' + method_param + "]]"
else:
- tag_text="[[#"+param+"|"+param+"]]"
- elif (cmd.find("image=")==0):
- tag_text="{{"+cmd[6:]+"}}"
- elif (cmd.find("url=")==0):
- tag_text="[["+cmd[4:]+"|"
- elif (cmd=="/url"):
- tag_text="]]>"
- elif (cmd=="center"):
- tag_text=""
- elif (cmd=="/center"):
- tag_text=""
- elif (cmd=="br"):
- tag_text="\\\\\n"
- elif (cmd=="i" or cmd=="/i"):
- tag_text="//"
- elif (cmd=="b" or cmd=="/b"):
- tag_text="**"
- elif (cmd=="u" or cmd=="/u"):
- tag_text="__"
+ tag_text = "[[#" + param + "|" + param + "]]"
+ elif (cmd.find("image=") == 0):
+ tag_text = "{{" + cmd[6:] + "}}"
+ elif (cmd.find("url=") == 0):
+ tag_text = "[[" + cmd[4:] + "|"
+ elif (cmd == "/url"):
+ tag_text = "]]>"
+ elif (cmd == "center"):
+ tag_text = ""
+ elif (cmd == "/center"):
+ tag_text = ""
+ elif (cmd == "br"):
+ tag_text = "\\\\\n"
+ elif (cmd == "i" or cmd == "/i"):
+ tag_text = "//"
+ elif (cmd == "b" or cmd == "/b"):
+ tag_text = "**"
+ elif (cmd == "u" or cmd == "/u"):
+ tag_text = "__"
else:
- tag_text="["+tag_text+"]"
+ tag_text = "[" + tag_text + "]"
- text=pre_text+tag_text+post_text
- pos=len(pre_text)+len(tag_text)
+ text = pre_text + tag_text + post_text
+ pos = len(pre_text) + len(tag_text)
#tnode = ET.SubElement(parent,"div")
- #tnode.text=text
+ # tnode.text=text
return text
def make_type(t):
global class_names
if (t in class_names):
- return "[["+t.lower()+"|"+t+"]]"
+ return "[[" + t.lower() + "|" + t + "]]"
return t
-def make_method(f,name,m,declare,event=False):
+def make_method(f, name, m, declare, event=False):
- s=" * "
- ret_type="void"
- args=list(m)
- mdata={}
- mdata["argidx"]=[]
+ s = " * "
+ ret_type = "void"
+ args = list(m)
+ mdata = {}
+ mdata["argidx"] = []
for a in args:
- if (a.tag=="return"):
- idx=-1
- elif (a.tag=="argument"):
- idx=int(a.attrib["index"])
+ if (a.tag == "return"):
+ idx = -1
+ elif (a.tag == "argument"):
+ idx = int(a.attrib["index"])
else:
continue
mdata["argidx"].append(idx)
- mdata[idx]=a
+ mdata[idx] = a
if (not event):
if (-1 in mdata["argidx"]):
- s+=make_type(mdata[-1].attrib["type"])
+ s += make_type(mdata[-1].attrib["type"])
else:
- s+="void"
- s+=" "
+ s += "void"
+ s += " "
if (declare):
- #span.attrib["class"]="funcdecl"
- #a=ET.SubElement(span,"a")
- #a.attrib["name"]=name+"_"+m.attrib["name"]
- #a.text=name+"::"+m.attrib["name"]
- s+="**"+m.attrib["name"]+"**"
+ # span.attrib["class"]="funcdecl"
+ # a=ET.SubElement(span,"a")
+ # a.attrib["name"]=name+"_"+m.attrib["name"]
+ # a.text=name+"::"+m.attrib["name"]
+ s += "**" + m.attrib["name"] + "**"
else:
- s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]"
+ s += "[[#" + m.attrib["name"] + "|" + m.attrib["name"] + "]]"
- s+="**(**"
- argfound=False
+ s += "**(**"
+ argfound = False
for a in mdata["argidx"]:
- arg=mdata[a]
- if (a<0):
+ arg = mdata[a]
+ if (a < 0):
continue
- if (a>0):
- s+=", "
+ if (a > 0):
+ s += ", "
else:
- s+=" "
+ s += " "
- s+=make_type(arg.attrib["type"])
+ s += make_type(arg.attrib["type"])
if ("name" in arg.attrib):
- s+=" "+arg.attrib["name"]
+ s += " " + arg.attrib["name"]
else:
- s+=" arg"+str(a)
+ s += " arg" + str(a)
if ("default" in arg.attrib):
- s+="="+arg.attrib["default"]
+ s += "=" + arg.attrib["default"]
- argfound=True
+ argfound = True
if (argfound):
- s+=" "
- s+="**)**"
+ s += " "
+ s += "**)**"
if ("qualifiers" in m.attrib):
- s+=" "+m.attrib["qualifiers"]
+ s += " " + m.attrib["qualifiers"]
- f.write(s+"\n")
+ f.write(s + "\n")
def make_doku_class(node):
name = node.attrib["name"]
- f=open(name.lower()+".txt","wb")
+ f = open(name.lower() + ".txt", "wb")
- f.write("====== "+name+" ======\n")
+ f.write("====== " + name + " ======\n")
if ("inherits" in node.attrib):
- inh=node.attrib["inherits"].strip()
- f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n")
+ inh = node.attrib["inherits"].strip()
+ f.write("**Inherits:** [[" + inh.lower() + "|" + inh + "]]\\\\\n")
if ("category" in node.attrib):
- f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n")
+ f.write("**Category:** " + node.attrib["category"].strip() + "\\\\\n")
briefd = node.find("brief_description")
- if (briefd!=None):
+ if (briefd != None):
f.write("===== Brief Description ======\n")
- f.write( dokuize_text(briefd.text.strip())+"\n" )
+ f.write(dokuize_text(briefd.text.strip()) + "\n")
methods = node.find("methods")
- if(methods!=None and len(list(methods))>0):
+ if(methods != None and len(list(methods)) > 0):
f.write("===== Member Functions ======\n")
for m in list(methods):
- make_method(f,node.attrib["name"],m,False)
+ make_method(f, node.attrib["name"], m, False)
events = node.find("signals")
- if(events!=None and len(list(events))>0):
+ if(events != None and len(list(events)) > 0):
f.write("===== Signals ======\n")
for m in list(events):
- make_method(f,node.attrib["name"],m,True,True)
+ make_method(f, node.attrib["name"], m, True, True)
members = node.find("members")
- if(members!=None and len(list(members))>0):
+ if(members != None and len(list(members)) > 0):
f.write("===== Member Variables ======\n")
for c in list(members):
s = " * "
- s+=make_type(c.attrib["type"])+" "
- s+="**"+c.attrib["name"]+"**"
- if (c.text.strip()!=""):
- s+=" - "+c.text.strip()
- f.write(s+"\n")
+ s += make_type(c.attrib["type"]) + " "
+ s += "**" + c.attrib["name"] + "**"
+ if (c.text.strip() != ""):
+ s += " - " + c.text.strip()
+ f.write(s + "\n")
constants = node.find("constants")
- if(constants!=None and len(list(constants))>0):
+ if(constants != None and len(list(constants)) > 0):
f.write("===== Numeric Constants ======\n")
for c in list(constants):
s = " * "
- s+="**"+c.attrib["name"]+"**"
+ s += "**" + c.attrib["name"] + "**"
if ("value" in c.attrib):
- s+=" = **"+c.attrib["value"]+"**"
- if (c.text.strip()!=""):
- s+=" - "+c.text.strip()
- f.write(s+"\n")
+ s += " = **" + c.attrib["value"] + "**"
+ if (c.text.strip() != ""):
+ s += " - " + c.text.strip()
+ f.write(s + "\n")
- descr=node.find("description")
- if (descr!=None and descr.text.strip()!=""):
+ descr = node.find("description")
+ if (descr != None and descr.text.strip() != ""):
f.write("===== Description ======\n")
- f.write(dokuize_text(descr.text.strip())+"\n")
+ f.write(dokuize_text(descr.text.strip()) + "\n")
methods = node.find("methods")
- if(methods!=None and len(list(methods))>0):
+ if(methods != None and len(list(methods)) > 0):
f.write("===== Member Function Description ======\n")
for m in list(methods):
- d=m.find("description")
- if (d==None or d.text.strip()==""):
+ d = m.find("description")
+ if (d == None or d.text.strip() == ""):
continue
- f.write("== "+m.attrib["name"]+" ==\n")
- make_method(f,node.attrib["name"],m,False)
+ f.write("== " + m.attrib["name"] + " ==\n")
+ make_method(f, node.attrib["name"], m, False)
f.write("\\\\\n")
f.write(dokuize_text(d.text.strip()))
f.write("\n")
@@ -488,27 +488,27 @@ def make_doku_class(node):
"""
for file in input_list:
tree = ET.parse(file)
- doc=tree.getroot()
+ doc = tree.getroot()
if ("version" not in doc.attrib):
print("Version missing from 'doc'")
sys.exit(255)
- version=doc.attrib["version"]
+ version = doc.attrib["version"]
for c in list(doc):
if (c.attrib["name"] in class_names):
continue
class_names.append(c.attrib["name"])
- classes[c.attrib["name"]]=c
+ classes[c.attrib["name"]] = c
class_names.sort()
-make_class_list(class_names,4)
+make_class_list(class_names, 4)
for cn in class_names:
- c=classes[cn]
+ c = classes[cn]
make_doku_class(c)
diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py
index 12f92883a..95a35960b 100644
--- a/doc/tools/makehtml.py
+++ b/doc/tools/makehtml.py
@@ -10,7 +10,7 @@ html_escape_table = {
"'": "'"
}
-html_unescape_table = {v:k for k, v in html_escape_table.items()}
+html_unescape_table = {v: k for k, v in html_escape_table.items()}
def html_escape(text):
return escape(text, html_escape_table)
@@ -20,7 +20,7 @@ def html_unescape(text):
input_list = []
-single_page=True
+single_page = True
for arg in sys.argv[1:]:
if arg[:1] == "-":
@@ -36,106 +36,106 @@ if len(input_list) < 1:
sys.exit(0)
-def validate_tag(elem,tag):
+def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '"+tag+"', got "+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")
+ # 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):
+def make_html_top(body, bottom=False):
if (bottom):
- ET.SubElement(body,"hr")
-
- table = ET.SubElement(body,"table")
- table.attrib["class"]="top_table"
- tr = ET.SubElement(table,"tr")
- td = ET.SubElement(tr,"td")
- td.attrib["class"]="top_table"
-
- img = ET.SubElement(td,"image")
- img.attrib["src"]="images/logo.png"
- td = ET.SubElement(tr,"td")
- td.attrib["class"]="top_table"
- a = ET.SubElement(td,"a")
- a.attrib["href"]="index.html"
- a.text="Index"
- td = ET.SubElement(tr,"td")
- td.attrib["class"]="top_table"
- a = ET.SubElement(td,"a")
- a.attrib["href"]="alphabetical.html"
- a.text="Classes"
- td = ET.SubElement(tr,"td")
- td.attrib["class"]="top_table"
- a = ET.SubElement(td,"a")
- a.attrib["href"]="category.html"
- a.text="Categories"
- td = ET.SubElement(tr,"td")
- a = ET.SubElement(td,"a")
- a.attrib["href"]="inheritance.html"
- a.text="Inheritance"
+ ET.SubElement(body, "hr")
+
+ table = ET.SubElement(body, "table")
+ table.attrib["class"] = "top_table"
+ tr = ET.SubElement(table, "tr")
+ td = ET.SubElement(tr, "td")
+ td.attrib["class"] = "top_table"
+
+ img = ET.SubElement(td, "image")
+ img.attrib["src"] = "images/logo.png"
+ td = ET.SubElement(tr, "td")
+ td.attrib["class"] = "top_table"
+ a = ET.SubElement(td, "a")
+ a.attrib["href"] = "index.html"
+ a.text = "Index"
+ td = ET.SubElement(tr, "td")
+ td.attrib["class"] = "top_table"
+ a = ET.SubElement(td, "a")
+ a.attrib["href"] = "alphabetical.html"
+ a.text = "Classes"
+ td = ET.SubElement(tr, "td")
+ td.attrib["class"] = "top_table"
+ a = ET.SubElement(td, "a")
+ a.attrib["href"] = "category.html"
+ a.text = "Categories"
+ td = ET.SubElement(tr, "td")
+ a = ET.SubElement(td, "a")
+ a.attrib["href"] = "inheritance.html"
+ a.text = "Inheritance"
if (not bottom):
- ET.SubElement(body,"hr")
+ ET.SubElement(body, "hr")
-def make_html_class_list(class_list,columns):
+def make_html_class_list(class_list, columns):
- div=ET.Element("div")
- div.attrib["class"]="ClassList";
+ div = ET.Element("div")
+ div.attrib["class"] = "ClassList";
- h1=ET.SubElement(div,"h2")
- h1.text="Alphabetical Class List"
+ h1 = ET.SubElement(div, "h2")
+ h1.text = "Alphabetical Class List"
- table=ET.SubElement(div,"table")
- table.attrib["class"]="class_table"
- table.attrib["width"]="100%"
- prev=0
+ table = ET.SubElement(div, "table")
+ table.attrib["class"] = "class_table"
+ table.attrib["width"] = "100%"
+ prev = 0
col_max = len(class_list) / columns + 1
print("col max is ", col_max)
col_count = 0
row_count = 0
last_initial = ""
- fit_columns=[]
+ fit_columns = []
- for n in range(0,columns):
- fit_columns+=[[]]
+ for n in range(0, columns):
+ fit_columns += [[]]
- indexers=[]
- last_initial=""
+ indexers = []
+ last_initial = ""
- idx=0
+ idx = 0
for n in class_list:
- col = int(idx/col_max)
- if (col>=columns):
- col=columns-1
- fit_columns[col]+=[n]
- idx+=1
- if (n[:1]!=last_initial):
- 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):
- tr = ET.SubElement(table,"tr")
- for c in range(0,columns):
- tdi = ET.SubElement(tr,"td")
- tdi.attrib["align"]="right"
- td = ET.SubElement(tr,"td")
- if (r>=len(fit_columns[c])):
+ col = int(idx / col_max)
+ if (col >= columns):
+ col = columns - 1
+ fit_columns[col] += [n]
+ idx += 1
+ if (n[:1] != last_initial):
+ 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):
+ tr = ET.SubElement(table, "tr")
+ for c in range(0, columns):
+ tdi = ET.SubElement(tr, "td")
+ tdi.attrib["align"] = "right"
+ td = ET.SubElement(tr, "td")
+ if (r >= len(fit_columns[c])):
continue
classname = fit_columns[c][r]
@@ -147,17 +147,17 @@ def make_html_class_list(class_list,columns):
span.text = classname[:1].upper()
if (single_page):
- link="#"+classname
+ link = "#" + classname
else:
- link=classname+".html"
+ link = classname + ".html"
- a=ET.SubElement(td,"a")
- a.attrib["href"]=link
- a.text=classname
+ a = ET.SubElement(td, "a")
+ a.attrib["href"] = link
+ a.text = classname
if (not single_page):
- cat_class_list=ET.Element("html")
+ cat_class_list = ET.Element("html")
csscc = ET.SubElement(cat_class_list, "link")
csscc.attrib["href"] = "main.css"
csscc.attrib["rel"] = "stylesheet"
@@ -165,62 +165,62 @@ def make_html_class_list(class_list,columns):
bodycc = ET.SubElement(cat_class_list, "body")
make_html_top(bodycc)
- cat_class_parent=bodycc
+ cat_class_parent = bodycc
else:
- cat_class_parent=div
+ cat_class_parent = div
- h1=ET.SubElement(cat_class_parent,"h2")
- h1.text="Class List By Category"
+ h1 = ET.SubElement(cat_class_parent, "h2")
+ h1.text = "Class List By Category"
- class_cat_table={}
- class_cat_list=[]
+ class_cat_table = {}
+ class_cat_list = []
for c in class_list:
clss = classes[c]
if ("category" in clss.attrib):
- class_cat=clss.attrib["category"]
+ class_cat = clss.attrib["category"]
else:
- class_cat="Core"
- if (class_cat.find("/")!=-1):
- class_cat=class_cat[class_cat.rfind("/")+1:]
+ class_cat = "Core"
+ if (class_cat.find("/") != -1):
+ class_cat = class_cat[class_cat.rfind("/") + 1:]
if (not class_cat in class_cat_list):
class_cat_list.append(class_cat)
- class_cat_table[class_cat]=[]
+ class_cat_table[class_cat] = []
class_cat_table[class_cat].append(c)
class_cat_list.sort()
- ct = ET.SubElement(cat_class_parent,"table")
+ ct = ET.SubElement(cat_class_parent, "table")
for cl in class_cat_list:
l = class_cat_table[cl]
l.sort()
- tr = ET.SubElement(ct,"tr")
- tr.attrib["class"]="category_title"
- td = ET.SubElement(ct,"td")
- td.attrib["class"]="category_title"
+ tr = ET.SubElement(ct, "tr")
+ tr.attrib["class"] = "category_title"
+ td = ET.SubElement(ct, "td")
+ td.attrib["class"] = "category_title"
- a = ET.SubElement(td,"a")
- a.attrib["class"]="category_title"
- a.text=cl
- a.attrib["name"]="CATEGORY_"+cl
+ a = ET.SubElement(td, "a")
+ a.attrib["class"] = "category_title"
+ a.text = cl
+ a.attrib["name"] = "CATEGORY_" + cl
- td = ET.SubElement(ct,"td")
- td.attrib["class"]="category_title"
+ td = ET.SubElement(ct, "td")
+ td.attrib["class"] = "category_title"
for clt in l:
- tr = ET.SubElement(ct,"tr")
- td = ET.SubElement(ct,"td")
- make_type(clt,td)
- clss=classes[clt]
+ tr = ET.SubElement(ct, "tr")
+ td = ET.SubElement(ct, "td")
+ make_type(clt, td)
+ clss = classes[clt]
bd = clss.find("brief_description")
- bdtext=""
- if (bd!=None):
- bdtext=bd.text
- td = ET.SubElement(ct,"td")
- td.text=bdtext
+ bdtext = ""
+ if (bd != None):
+ bdtext = bd.text
+ td = ET.SubElement(ct, "td")
+ td.text = bdtext
if (not single_page):
make_html_bottom(bodycc)
@@ -229,31 +229,31 @@ def make_html_class_list(class_list,columns):
if (not single_page):
- inh_class_list=ET.Element("html")
+ inh_class_list = ET.Element("html")
cssic = ET.SubElement(inh_class_list, "link")
cssic.attrib["href"] = "main.css"
cssic.attrib["rel"] = "stylesheet"
cssic.attrib["type"] = "text/css"
bodyic = ET.SubElement(inh_class_list, "body")
make_html_top(bodyic)
- inh_class_parent=bodyic
+ inh_class_parent = bodyic
else:
- inh_class_parent=div
+ inh_class_parent = div
- h1=ET.SubElement(inh_class_parent,"h2")
- h1.text="Class List By Inheritance"
+ h1 = ET.SubElement(inh_class_parent, "h2")
+ h1.text = "Class List By Inheritance"
- itemlist = ET.SubElement(inh_class_parent,"list")
+ itemlist = ET.SubElement(inh_class_parent, "list")
- class_inh_table={}
+ class_inh_table = {}
def add_class(clss):
if (clss.attrib["name"] in class_inh_table):
- return #already added
- parent_list=None
+ return # already added
+ parent_list = None
if ("inherits" in clss.attrib):
inhc = clss.attrib["inherits"]
@@ -262,20 +262,20 @@ def make_html_class_list(class_list,columns):
parent_list = class_inh_table[inhc].find("div")
if (parent_list == None):
- parent_div = ET.SubElement(class_inh_table[inhc],"div")
- parent_list = ET.SubElement(parent_div,"list")
- parent_div.attrib["class"]="inh_class_list"
+ parent_div = ET.SubElement(class_inh_table[inhc], "div")
+ parent_list = ET.SubElement(parent_div, "list")
+ parent_div.attrib["class"] = "inh_class_list"
else:
parent_list = parent_list.find("list")
else:
- parent_list=itemlist
+ parent_list = itemlist
- item = ET.SubElement(parent_list,"li")
+ item = ET.SubElement(parent_list, "li")
# item.attrib["class"]="inh_class_list"
- class_inh_table[clss.attrib["name"]]=item
- make_type(clss.attrib["name"],item)
+ class_inh_table[clss.attrib["name"]] = item
+ make_type(clss.attrib["name"], item)
for c in class_list:
@@ -290,98 +290,98 @@ def make_html_class_list(class_list,columns):
- #h1=ET.SubElement(div,"h2")
+ # h1=ET.SubElement(div,"h2")
#h1.text="Class List By Inheritance"
return div
-def make_type(p_type,p_parent):
- if (p_type=="RefPtr"):
- p_type="Resource"
+def make_type(p_type, p_parent):
+ if (p_type == "RefPtr"):
+ p_type = "Resource"
if (p_type in class_names):
- a=ET.SubElement(p_parent,"a")
- a.attrib["class"]="datatype_existing"
- a.text=p_type+" "
+ a = ET.SubElement(p_parent, "a")
+ a.attrib["class"] = "datatype_existing"
+ a.text = p_type + " "
if (single_page):
- a.attrib["href"]="#"+p_type
+ a.attrib["href"] = "#" + p_type
else:
- a.attrib["href"]=p_type+".html"
+ a.attrib["href"] = p_type + ".html"
else:
- span=ET.SubElement(p_parent,"span")
- span.attrib["class"]="datatype"
- span.text=p_type+" "
+ span = ET.SubElement(p_parent, "span")
+ span.attrib["class"] = "datatype"
+ span.text = p_type + " "
-def make_text_def(class_name,parent,text):
+def make_text_def(class_name, parent, text):
text = html_escape(text)
- pos=0
+ pos = 0
while(True):
- pos = text.find("[",pos)
- if (pos==-1):
+ pos = text.find("[", pos)
+ if (pos == -1):
break
- endq_pos=text.find("]",pos+1)
- if (endq_pos==-1):
+ endq_pos = text.find("]", pos + 1)
+ if (endq_pos == -1):
break
- pre_text=text[:pos]
- post_text=text[endq_pos+1:]
- tag_text=text[pos+1:endq_pos]
+ pre_text = text[:pos]
+ post_text = text[endq_pos + 1:]
+ tag_text = text[pos + 1:endq_pos]
if (tag_text in class_names):
if (single_page):
- tag_text=''+tag_text+''
+ tag_text = '' + tag_text + ''
else:
- tag_text=''+tag_text+''
- else: #command
- cmd=tag_text
- space_pos=tag_text.find(" ")
- if (cmd.find("html")==0):
- cmd=tag_text[:space_pos]
- param=tag_text[space_pos+1:]
- tag_text="<"+param+">"
- elif(cmd.find("method")==0):
- cmd=tag_text[:space_pos]
- param=tag_text[space_pos+1:]
-
- if (not single_page and param.find(".")!=-1):
- class_param,method_param=param.split(".")
- tag_text=tag_text=''+class_param+'.'+method_param+'()'
+ tag_text = '' + tag_text + ''
+ else: # command
+ cmd = tag_text
+ space_pos = tag_text.find(" ")
+ if (cmd.find("html") == 0):
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+ tag_text = "<" + param + ">"
+ elif(cmd.find("method") == 0):
+ cmd = tag_text[:space_pos]
+ param = tag_text[space_pos + 1:]
+
+ if (not single_page and param.find(".") != -1):
+ class_param, method_param = param.split(".")
+ tag_text = tag_text = '' + class_param + '.' + method_param + '()'
else:
- tag_text=tag_text=''+class_name+'.'+param+'()'
- elif (cmd.find("image=")==0):
- print("found image: "+cmd)
- tag_text="
"
- elif (cmd.find("url=")==0):
- tag_text=""
- elif (cmd=="/url"):
- tag_text=""
- elif (cmd=="center"):
- tag_text=""
- elif (cmd=="/center"):
- tag_text="
"
- elif (cmd=="br"):
- tag_text="
"
- elif (cmd=="i" or cmd=="/i" or cmd=="b" or cmd=="/b" or cmd=="u" or cmd=="/u"):
- tag_text="<"+tag_text+">" #html direct mapping
+ tag_text = tag_text = '' + class_name + '.' + param + '()'
+ elif (cmd.find("image=") == 0):
+ print("found image: " + cmd)
+ tag_text = "
"
+ elif (cmd.find("url=") == 0):
+ tag_text = ""
+ elif (cmd == "/url"):
+ tag_text = ""
+ elif (cmd == "center"):
+ tag_text = ""
+ elif (cmd == "/center"):
+ tag_text = "
"
+ elif (cmd == "br"):
+ tag_text = "
"
+ elif (cmd == "i" or cmd == "/i" or cmd == "b" or cmd == "/b" or cmd == "u" or cmd == "/u"):
+ tag_text = "<" + tag_text + ">" # html direct mapping
else:
- tag_text="["+tag_text+"]"
+ tag_text = "[" + tag_text + "]"
- text=pre_text+tag_text+post_text
- pos=len(pre_text)+len(tag_text)
+ text = pre_text + tag_text + post_text
+ pos = len(pre_text) + len(tag_text)
#tnode = ET.SubElement(parent,"div")
- #tnode.text=text
- text=""+text+"
"
+ # tnode.text=text
+ text = "" + text + "
"
try:
- tnode=ET.XML(text)
+ tnode = ET.XML(text)
parent.append(tnode)
except:
- print("Error parsing description text: '"+text+"'")
+ print("Error parsing description text: '" + text + "'")
sys.exit(255)
@@ -390,292 +390,292 @@ def make_text_def(class_name,parent,text):
-def make_method_def(name,m,declare,event=False):
+def make_method_def(name, m, declare, event=False):
- mdata={}
+ mdata = {}
if (not declare):
- div=ET.Element("tr")
- div.attrib["class"]="method"
- ret_parent=ET.SubElement(div,"td")
- ret_parent.attrib["align"]="right"
- func_parent=ET.SubElement(div,"td")
+ div = ET.Element("tr")
+ div.attrib["class"] = "method"
+ ret_parent = ET.SubElement(div, "td")
+ ret_parent.attrib["align"] = "right"
+ func_parent = ET.SubElement(div, "td")
else:
- div=ET.Element("div")
- div.attrib["class"]="method"
- ret_parent=div
- func_parent=div
-
- mdata["argidx"]=[]
- mdata["name"]=m.attrib["name"]
- qualifiers=""
+ div = ET.Element("div")
+ div.attrib["class"] = "method"
+ ret_parent = div
+ func_parent = div
+
+ mdata["argidx"] = []
+ mdata["name"] = m.attrib["name"]
+ qualifiers = ""
if ("qualifiers" in m.attrib):
- qualifiers=m.attrib["qualifiers"]
+ qualifiers = m.attrib["qualifiers"]
- args=list(m)
+ args = list(m)
for a in args:
- if (a.tag=="return"):
- idx=-1
- elif (a.tag=="argument"):
- idx=int(a.attrib["index"])
+ if (a.tag == "return"):
+ idx = -1
+ elif (a.tag == "argument"):
+ idx = int(a.attrib["index"])
else:
continue
mdata["argidx"].append(idx)
- mdata[idx]=a
+ mdata[idx] = a
if (not event):
if (-1 in mdata["argidx"]):
- make_type(mdata[-1].attrib["type"],ret_parent)
+ make_type(mdata[-1].attrib["type"], ret_parent)
mdata["argidx"].remove(-1)
else:
- make_type("void",ret_parent)
+ make_type("void", ret_parent)
- span=ET.SubElement(func_parent,"span")
+ span = ET.SubElement(func_parent, "span")
if (declare):
- span.attrib["class"]="funcdecl"
- a=ET.SubElement(span,"a")
- a.attrib["name"]=name+"_"+m.attrib["name"]
- a.text=name+"::"+m.attrib["name"]
+ span.attrib["class"] = "funcdecl"
+ a = ET.SubElement(span, "a")
+ a.attrib["name"] = name + "_" + m.attrib["name"]
+ a.text = name + "::" + m.attrib["name"]
else:
- span.attrib["class"]="identifier funcdef"
- a=ET.SubElement(span,"a")
- a.attrib["href"]="#"+name+"_"+m.attrib["name"]
- a.text=m.attrib["name"]
+ span.attrib["class"] = "identifier funcdef"
+ a = ET.SubElement(span, "a")
+ a.attrib["href"] = "#" + name + "_" + m.attrib["name"]
+ a.text = m.attrib["name"]
- span=ET.SubElement(func_parent,"span")
- span.attrib["class"]="symbol"
- span.text=" ("
+ span = ET.SubElement(func_parent, "span")
+ span.attrib["class"] = "symbol"
+ span.text = " ("
for a in mdata["argidx"]:
- arg=mdata[a]
- if (a>0):
- span=ET.SubElement(func_parent,"span")
- span.text=", "
+ arg = mdata[a]
+ if (a > 0):
+ span = ET.SubElement(func_parent, "span")
+ span.text = ", "
else:
- span=ET.SubElement(func_parent,"span")
- span.text=" "
+ span = ET.SubElement(func_parent, "span")
+ span.text = " "
- make_type(arg.attrib["type"],func_parent)
+ make_type(arg.attrib["type"], func_parent)
- span=ET.SubElement(func_parent,"span")
- span.text=arg.attrib["name"]
+ span = ET.SubElement(func_parent, "span")
+ span.text = arg.attrib["name"]
if ("default" in arg.attrib):
- span.text=span.text+"="+arg.attrib["default"]
+ span.text = span.text + "=" + arg.attrib["default"]
- span=ET.SubElement(func_parent,"span")
- span.attrib["class"]="symbol"
+ span = ET.SubElement(func_parent, "span")
+ span.attrib["class"] = "symbol"
if (len(mdata["argidx"])):
- span.text=" )"
+ span.text = " )"
else:
- span.text=")"
+ span.text = ")"
if (qualifiers):
- span=ET.SubElement(func_parent,"span")
- span.attrib["class"]="qualifier"
- span.text=" "+qualifiers
+ span = ET.SubElement(func_parent, "span")
+ span.attrib["class"] = "qualifier"
+ span.text = " " + qualifiers
return div
def make_html_class(node):
- div=ET.Element("div")
- div.attrib["class"]="class";
+ div = ET.Element("div")
+ div.attrib["class"] = "class";
- a=ET.SubElement(div,"a")
- a.attrib["name"]=node.attrib["name"]
+ a = ET.SubElement(div, "a")
+ a.attrib["name"] = node.attrib["name"]
- h3=ET.SubElement(a,"h3")
- h3.attrib["class"]="title class_title"
- h3.text=node.attrib["name"]
+ h3 = ET.SubElement(a, "h3")
+ h3.attrib["class"] = "title class_title"
+ h3.text = node.attrib["name"]
briefd = node.find("brief_description")
- if (briefd!=None):
- div2=ET.SubElement(div,"div")
- div2.attrib["class"]="description class_description"
- div2.text=briefd.text
+ if (briefd != None):
+ div2 = ET.SubElement(div, "div")
+ div2.attrib["class"] = "description class_description"
+ div2.text = briefd.text
if ("inherits" in node.attrib):
- ET.SubElement(div,"br")
+ ET.SubElement(div, "br")
- div2=ET.SubElement(div,"div")
- div2.attrib["class"]="inheritance";
+ div2 = ET.SubElement(div, "div")
+ div2.attrib["class"] = "inheritance";
- span=ET.SubElement(div2,"span")
- span.text="Inherits: "
+ span = ET.SubElement(div2, "span")
+ span.text = "Inherits: "
- make_type(node.attrib["inherits"],div2)
+ make_type(node.attrib["inherits"], div2)
if ("category" in node.attrib):
- ET.SubElement(div,"br")
+ ET.SubElement(div, "br")
- div3=ET.SubElement(div,"div")
- div3.attrib["class"]="category";
+ div3 = ET.SubElement(div, "div")
+ div3.attrib["class"] = "category";
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="category"
- span.text="Category: "
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "category"
+ span.text = "Category: "
- a = ET.SubElement(div3,"a")
- a.attrib["class"]="category_ref"
- a.text=node.attrib["category"]
- catname=a.text
- if (catname.rfind("/")!=-1):
- catname=catname[catname.rfind("/"):]
- catname="CATEGORY_"+catname
+ a = ET.SubElement(div3, "a")
+ a.attrib["class"] = "category_ref"
+ a.text = node.attrib["category"]
+ catname = a.text
+ if (catname.rfind("/") != -1):
+ catname = catname[catname.rfind("/"):]
+ catname = "CATEGORY_" + catname
if (single_page):
- a.attrib["href"]="#"+catname
+ a.attrib["href"] = "#" + catname
else:
- a.attrib["href"]="category.html#"+catname
+ a.attrib["href"] = "category.html#" + catname
methods = node.find("methods")
- if(methods!=None and len(list(methods))>0):
+ if(methods != None and len(list(methods)) > 0):
- h4=ET.SubElement(div,"h4")
- h4.text="Public Methods:"
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Public Methods:"
- method_table=ET.SubElement(div,"table")
- method_table.attrib["class"]="method_list";
+ method_table = ET.SubElement(div, "table")
+ method_table.attrib["class"] = "method_list";
for m in list(methods):
#li = ET.SubElement(div2, "li")
- method_table.append( make_method_def(node.attrib["name"],m,False) )
+ method_table.append(make_method_def(node.attrib["name"], m, False))
events = node.find("signals")
- if(events!=None and len(list(events))>0):
- h4=ET.SubElement(div,"h4")
- h4.text="Events:"
+ if(events != None and len(list(events)) > 0):
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Events:"
- event_table=ET.SubElement(div,"table")
- event_table.attrib["class"]="method_list";
+ event_table = ET.SubElement(div, "table")
+ event_table.attrib["class"] = "method_list";
for m in list(events):
#li = ET.SubElement(div2, "li")
- event_table.append( make_method_def(node.attrib["name"],m,False,True) )
+ event_table.append(make_method_def(node.attrib["name"], m, False, True))
members = node.find("members")
- if(members!=None and len(list(members))>0):
+ if(members != None and len(list(members)) > 0):
- h4=ET.SubElement(div,"h4")
- h4.text="Public Variables:"
- div2=ET.SubElement(div,"div")
- div2.attrib["class"]="member_list";
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Public Variables:"
+ div2 = ET.SubElement(div, "div")
+ div2.attrib["class"] = "member_list";
for c in list(members):
li = ET.SubElement(div2, "li")
- div3=ET.SubElement(li,"div")
- div3.attrib["class"]="member";
- make_type(c.attrib["type"],div3)
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="identifier member_name"
- span.text=" "+c.attrib["name"]+" "
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="member_description"
- span.text=c.text
+ div3 = ET.SubElement(li, "div")
+ div3.attrib["class"] = "member";
+ make_type(c.attrib["type"], div3)
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "identifier member_name"
+ span.text = " " + c.attrib["name"] + " "
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "member_description"
+ span.text = c.text
constants = node.find("constants")
- if(constants!=None and len(list(constants))>0):
+ if(constants != None and len(list(constants)) > 0):
- h4=ET.SubElement(div,"h4")
- h4.text="Constants:"
- div2=ET.SubElement(div,"div")
- div2.attrib["class"]="constant_list";
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Constants:"
+ div2 = ET.SubElement(div, "div")
+ div2.attrib["class"] = "constant_list";
for c in list(constants):
li = ET.SubElement(div2, "li")
- div3=ET.SubElement(li,"div")
- div3.attrib["class"]="constant";
+ div3 = ET.SubElement(li, "div")
+ div3.attrib["class"] = "constant";
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="identifier constant_name"
- span.text=c.attrib["name"]+" "
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "identifier constant_name"
+ span.text = c.attrib["name"] + " "
if ("value" in c.attrib):
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="symbol"
- span.text="= "
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="constant_value"
- span.text=c.attrib["value"]+" "
- span=ET.SubElement(div3,"span")
- span.attrib["class"]="constant_description"
- span.text=c.text
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "symbol"
+ span.text = "= "
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "constant_value"
+ span.text = c.attrib["value"] + " "
+ span = ET.SubElement(div3, "span")
+ span.attrib["class"] = "constant_description"
+ span.text = c.text
# ET.SubElement(div,"br")
- descr=node.find("description")
- if (descr!=None and descr.text.strip()!=""):
- h4=ET.SubElement(div,"h4")
- h4.text="Description:"
+ descr = node.find("description")
+ if (descr != None and descr.text.strip() != ""):
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Description:"
- make_text_def(node.attrib["name"],div,descr.text)
+ make_text_def(node.attrib["name"], div, descr.text)
# div2=ET.SubElement(div,"div")
# div2.attrib["class"]="description";
# div2.text=descr.text
- if(methods!=None or events!=None):
+ if(methods != None or events != None):
- h4=ET.SubElement(div,"h4")
- h4.text="Method Documentation:"
+ h4 = ET.SubElement(div, "h4")
+ h4.text = "Method Documentation:"
iter_list = []
- if (methods!=None):
- iter_list+=list(methods)
- if (events!=None):
- iter_list+=list(events)
+ if (methods != None):
+ iter_list += list(methods)
+ if (events != None):
+ iter_list += list(events)
for m in iter_list:
- descr=m.find("description")
+ descr = m.find("description")
- if (descr==None or descr.text.strip()==""):
+ if (descr == None or descr.text.strip() == ""):
continue;
- div2=ET.SubElement(div,"div")
- div2.attrib["class"]="method_doc";
+ div2 = ET.SubElement(div, "div")
+ div2.attrib["class"] = "method_doc";
- div2.append( make_method_def(node.attrib["name"],m,True) )
+ div2.append(make_method_def(node.attrib["name"], m, True))
#anchor = ET.SubElement(div2, "a")
- #anchor.attrib["name"] =
- make_text_def(node.attrib["name"],div2,descr.text)
- #div3=ET.SubElement(div2,"div")
- #div3.attrib["class"]="description";
- #div3.text=descr.text
+ # anchor.attrib["name"] =
+ make_text_def(node.attrib["name"], div2, descr.text)
+ # div3=ET.SubElement(div2,"div")
+ # div3.attrib["class"]="description";
+ # div3.text=descr.text
return div
-class_names=[]
-classes={}
+class_names = []
+classes = {}
for file in input_list:
tree = ET.parse(file)
- doc=tree.getroot()
+ doc = tree.getroot()
if ("version" not in doc.attrib):
print("Version missing from 'doc'")
sys.exit(255)
- version=doc.attrib["version"]
+ version = doc.attrib["version"]
for c in list(doc):
if (c.attrib["name"] in class_names):
continue
class_names.append(c.attrib["name"])
- classes[c.attrib["name"]]=c
+ classes[c.attrib["name"]] = c
html = ET.Element("html")
css = ET.SubElement(html, "link")
@@ -691,24 +691,24 @@ if (not single_page):
class_names.sort()
-body.append( make_html_class_list(class_names,5) )
+body.append(make_html_class_list(class_names, 5))
for cn in class_names:
- c=classes[cn]
+ c = classes[cn]
if (single_page):
- body.append( make_html_class(c))
+ body.append(make_html_class(c))
else:
html2 = ET.Element("html")
css = ET.SubElement(html2, "link")
css.attrib["href"] = "main.css"
css.attrib["rel"] = "stylesheet"
css.attrib["type"] = "text/css"
- body2 = ET.SubElement(html2, "body" )
+ body2 = ET.SubElement(html2, "body")
make_html_top(body2)
- body2.append( make_html_class(c) );
+ body2.append(make_html_class(c));
make_html_bottom(body2)
et_out = ET.ElementTree(html2)
- et_out.write(c.attrib["name"]+".html")
+ et_out.write(c.attrib["name"] + ".html")
et_out = ET.ElementTree(html)
diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py
index 2c9d69703..0693291f3 100644
--- a/doc/tools/makemd.py
+++ b/doc/tools/makemd.py
@@ -82,7 +82,7 @@ def make_class_list(class_list, columns):
else:
s += ' | '
- s += '[' + classname + '](class_'+ classname.lower()+') | '
+ s += '[' + classname + '](class_' + classname.lower() + ') | '
s += '\n'
f.write(s)
@@ -126,14 +126,14 @@ def dokuize_text(text):
if param.find('.') != -1:
(class_param, method_param) = param.split('.')
- tag_text = '['+class_param+'.'+method_param.replace("_","_")+'](' + class_param.lower() + '#' \
+ tag_text = '[' + class_param + '.' + method_param.replace("_", "_") + '](' + class_param.lower() + '#' \
+ method_param + ')'
else:
- tag_text = '[' + param.replace("_","_") + '](#' + param + ')'
+ tag_text = '[' + param.replace("_", "_") + '](#' + param + ')'
elif cmd.find('image=') == 0:
tag_text = ''
elif cmd.find('url=') == 0:
- tag_text = '[' + cmd[4:] + ']('+cmd[4:]
+ tag_text = '[' + cmd[4:] + '](' + cmd[4:]
elif cmd == '/url':
tag_text = ')'
elif cmd == 'center':
@@ -205,9 +205,9 @@ def make_method(
# a.attrib["name"]=name+"_"+m.attrib["name"]
# a.text=name+"::"+m.attrib["name"]
- s += ' **'+m.attrib['name'].replace("_","_")+'** '
+ s += ' **' + m.attrib['name'].replace("_", "_") + '** '
else:
- s += ' **['+ m.attrib['name'].replace("_","_")+'](#' + m.attrib['name'] + ')** '
+ s += ' **[' + m.attrib['name'].replace("_", "_") + '](#' + m.attrib['name'] + ')** '
s += ' **(**'
argfound = False
@@ -245,13 +245,13 @@ def make_doku_class(node):
name = node.attrib['name']
- f = open("class_"+name.lower() + '.md', 'wb')
+ f = open("class_" + name.lower() + '.md', 'wb')
f.write('# ' + name + ' \n')
if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip()
- f.write('####**Inherits:** '+make_type(inh)+'\n')
+ f.write('####**Inherits:** ' + make_type(inh) + '\n')
if 'category' in node.attrib:
f.write('####**Category:** ' + node.attrib['category'].strip()
+ '\n')
@@ -313,7 +313,7 @@ def make_doku_class(node):
d = m.find('description')
if d == None or d.text.strip() == '':
continue
- f.write('\n#### ' + m.attrib['name'] + '\n')
+ f.write('\n#### ' + m.attrib['name'] + '\n')
make_method(f, node.attrib['name'], m, True)
f.write('\n')
f.write(dokuize_text(d.text.strip()))
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 583f9afea..2f3b9c269 100644
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -24,11 +24,11 @@ def validate_tag(elem, tag):
class_names = []
classes = {}
-def ul_string(str,ul):
- str+="\n"
- for i in range(len(str)-1):
- str+=ul
- str+="\n"
+def ul_string(str, ul):
+ str += "\n"
+ for i in range(len(str) - 1):
+ str += ul
+ str += "\n"
return str
def make_class_list(class_list, columns):
@@ -89,7 +89,7 @@ def make_class_list(class_list, columns):
else:
s += ' | '
- s += '[' + classname + '](class_'+ classname.lower()+') | '
+ s += '[' + classname + '](class_' + classname.lower() + ') | '
s += '\n'
f.write(s)
@@ -99,7 +99,7 @@ def make_class_list(class_list, columns):
f.write("\n")
-def rstize_text(text,cclass):
+def rstize_text(text, cclass):
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
pos = 0
@@ -109,9 +109,9 @@ def rstize_text(text,cclass):
break
pre_text = text[:pos]
- while text[pos+1] == '\t':
+ while text[pos + 1] == '\t':
pos += 1
- post_text = text[pos+1:]
+ post_text = text[pos + 1:]
# Handle codeblocks
if post_text.startswith("[codeblock]"):
@@ -130,14 +130,14 @@ def rstize_text(text,cclass):
break
to_skip = 0
- while code_pos+to_skip+1 < len(code_text) and code_text[code_pos+to_skip+1] == '\t':
+ while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
to_skip += 1
- if len(code_text[code_pos+to_skip+1:])==0:
+ if len(code_text[code_pos + to_skip + 1:]) == 0:
code_text = code_text[:code_pos] + "\n"
code_pos += 1
else:
- code_text = code_text[:code_pos] + "\n " + code_text[code_pos+to_skip+1:]
+ code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1:]
code_pos += 5 - to_skip
text = pre_text + "\n[codeblock]" + code_text + post_text
@@ -163,7 +163,7 @@ def rstize_text(text,cclass):
pos = text.find('_', pos)
if pos == -1:
break
- if not text[pos + 1].isalnum(): # don't escape within a snake_case word
+ if not text[pos + 1].isalnum(): # don't escape within a snake_case word
text = text[:pos] + "\_" + text[pos + 1:]
pos += 2
else:
@@ -186,7 +186,7 @@ def rstize_text(text,cclass):
if tag_text in class_names:
tag_text = make_type(tag_text)
- else: # command
+ else: # command
cmd = tag_text
space_pos = tag_text.find(' ')
if cmd.find('html') == 0:
@@ -199,13 +199,13 @@ def rstize_text(text,cclass):
if param.find('.') != -1:
(class_param, method_param) = param.split('.')
- tag_text = ':ref:`'+class_param+'.'+method_param+'`'
+ tag_text = ':ref:`' + class_param + '.' + method_param + '`'
else:
- tag_text = ':ref:`' + param + '`'
+ tag_text = ':ref:`' + param + '`'
elif cmd.find('image=') == 0:
- tag_text = "" #''
+ tag_text = "" # ''
elif cmd.find('url=') == 0:
- tag_text = ':ref:`' + cmd[4:] + '<'+cmd[4:]+">`"
+ tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`"
elif cmd == '/url':
tag_text = ')'
elif cmd == 'center':
@@ -234,7 +234,7 @@ def rstize_text(text,cclass):
elif cmd == 'code' or cmd == '/code':
tag_text = '``'
else:
- tag_text = ':ref:`' + tag_text + '`'
+ tag_text = ':ref:`' + tag_text + '`'
text = pre_text + tag_text + post_text
pos = len(pre_text) + len(tag_text)
@@ -248,7 +248,7 @@ def rstize_text(text,cclass):
def make_type(t):
global class_names
if t in class_names:
- return ':ref:`'+t+'`'
+ return ':ref:`' + t + '`'
return t
@@ -262,7 +262,7 @@ def make_method(
pp=None
):
- if (declare or pp==None):
+ if (declare or pp == None):
t = '- '
else:
t = ""
@@ -289,16 +289,16 @@ def make_method(
t += 'void'
t += ' '
- if declare or pp==None:
+ if declare or pp == None:
# span.attrib["class"]="funcdecl"
# a=ET.SubElement(span,"a")
# a.attrib["name"]=name+"_"+m.attrib["name"]
# a.text=name+"::"+m.attrib["name"]
- s = ' **'+m.attrib['name']+'** '
+ s = ' **' + m.attrib['name'] + '** '
else:
- s = ':ref:`'+ m.attrib['name']+'` '
+ s = ':ref:`' + m.attrib['name'] + '` '
s += ' **(**'
argfound = False
@@ -331,16 +331,16 @@ def make_method(
# f.write(s)
if (not declare):
- if (pp!=None):
- pp.append( (t,s) )
+ if (pp != None):
+ pp.append((t, s))
else:
- f.write("- "+t+" "+s+"\n")
+ f.write("- " + t + " " + s + "\n")
else:
- f.write(t+s+"\n")
+ f.write(t + s + "\n")
def make_heading(title, underline):
- return title + '\n' + underline*len(title) + "\n\n"
+ return title + '\n' + underline * len(title) + "\n\n"
@@ -348,47 +348,47 @@ def make_rst_class(node):
name = node.attrib['name']
- f = codecs.open("class_"+name.lower() + '.rst', 'wb', 'utf-8')
+ f = codecs.open("class_" + name.lower() + '.rst', 'wb', 'utf-8')
# Warn contributors not to edit this file directly
f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
- f.write(".. _class_"+name+":\n\n")
+ f.write(".. _class_" + name + ":\n\n")
f.write(make_heading(name, '='))
if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip()
# whle inh in classes[cn]
f.write('**Inherits:** ')
- first=True
+ first = True
while(inh in classes):
if (not first):
f.write(" **<** ")
else:
- first=False
+ first = False
f.write(make_type(inh))
inode = classes[inh]
if ('inherits' in inode.attrib):
- inh=inode.attrib['inherits'].strip()
+ inh = inode.attrib['inherits'].strip()
else:
- inh=None
+ inh = None
f.write("\n\n")
- inherited=[]
+ inherited = []
for cn in classes:
- c=classes[cn]
+ c = classes[cn]
if 'inherits' in c.attrib:
- if (c.attrib['inherits'].strip()==name):
+ if (c.attrib['inherits'].strip() == name):
inherited.append(c.attrib['name'])
if (len(inherited)):
f.write('**Inherited By:** ')
for i in range(len(inherited)):
- if (i>0):
+ if (i > 0):
f.write(", ")
f.write(make_type(inherited[i]))
f.write("\n\n")
@@ -398,41 +398,41 @@ def make_rst_class(node):
f.write(make_heading('Brief Description', '-'))
briefd = node.find('brief_description')
if briefd != None:
- f.write(rstize_text(briefd.text.strip(),name) + "\n\n")
+ f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
f.write(make_heading('Member Functions', '-'))
- ml=[]
+ ml = []
for m in list(methods):
- make_method(f, node.attrib['name'], m, False,name,False,ml)
+ make_method(f, node.attrib['name'], m, False, name, False, ml)
longest_t = 0
longest_s = 0
for s in ml:
sl = len(s[0])
- if (sl>longest_s):
- longest_s=sl
+ if (sl > longest_s):
+ longest_s = sl
tl = len(s[1])
- if (tl>longest_t):
- longest_t=tl
-
- sep="+"
- for i in range(longest_s+2):
- sep+="-"
- sep+="+"
- for i in range(longest_t+2):
- sep+="-"
- sep+="+\n"
+ if (tl > longest_t):
+ longest_t = tl
+
+ sep = "+"
+ for i in range(longest_s + 2):
+ sep += "-"
+ sep += "+"
+ for i in range(longest_t + 2):
+ sep += "-"
+ sep += "+\n"
f.write(sep)
for s in ml:
rt = s[0]
- while( len(rt) < longest_s ):
- rt+=" "
+ while(len(rt) < longest_s):
+ rt += " "
st = s[1]
- while( len(st) < longest_t ):
- st+=" "
- f.write("| "+rt+" | "+st+" |\n")
+ while(len(st) < longest_t):
+ st += " "
+ f.write("| " + rt + " | " + st + " |\n")
f.write(sep)
f.write('\n')
@@ -441,7 +441,7 @@ def make_rst_class(node):
if events != None and len(list(events)) > 0:
f.write(make_heading('Signals', '-'))
for m in list(events):
- make_method(f, node.attrib['name'], m, True,name, True)
+ make_method(f, node.attrib['name'], m, True, name, True)
f.write('\n')
members = node.find('members')
@@ -466,28 +466,28 @@ def make_rst_class(node):
if 'value' in c.attrib:
s += ' = **' + c.attrib['value'] + '**'
if c.text.strip() != '':
- s += ' --- ' + rstize_text(c.text.strip(),name)
+ s += ' --- ' + rstize_text(c.text.strip(), name)
f.write(s + '\n')
f.write('\n')
descr = node.find('description')
if descr != None and descr.text.strip() != '':
f.write(make_heading('Description', '-'))
- f.write(rstize_text(descr.text.strip(),name) + "\n\n")
+ f.write(rstize_text(descr.text.strip(), name) + "\n\n")
methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
f.write(make_heading('Member Function Description', '-'))
for m in list(methods):
- f.write(".. _class_"+name+"_"+m.attrib['name']+":\n\n")
+ f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
# f.write(ul_string(m.attrib['name'],"^"))
#f.write('\n' + m.attrib['name'] + '\n------\n')
- make_method(f, node.attrib['name'], m, True,name)
+ make_method(f, node.attrib['name'], m, True, name)
f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
continue
- f.write(rstize_text(d.text.strip(),name))
+ f.write(rstize_text(d.text.strip(), name))
f.write("\n\n")
f.write('\n')
@@ -510,7 +510,7 @@ for file in input_list:
class_names.sort()
-#Don't make class list for Sphinx, :toctree: handles it
+# Don't make class list for Sphinx, :toctree: handles it
#make_class_list(class_names, 2)
for cn in class_names:
diff --git a/drivers/SCsub b/drivers/SCsub
index 27871bb33..4ff770c7d 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -2,7 +2,7 @@
Import('env')
-env.drivers_sources=[]
+env.drivers_sources = []
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
SConscript("zlib/SCsub");
@@ -28,15 +28,15 @@ SConscript("png/SCsub");
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
-if (env["tools"]=="yes"):
+if (env["tools"] == "yes"):
SConscript("convex_decomp/SCsub");
-if env['vsproj']=="yes":
+if env['vsproj'] == "yes":
env.AddToVSProject(env.drivers_sources)
if env.split_drivers:
env.split_lib("drivers")
else:
- env.add_source_files(env.drivers_sources,"*.cpp")
- lib = env.Library("drivers",env.drivers_sources)
+ env.add_source_files(env.drivers_sources, "*.cpp")
+ lib = env.Library("drivers", env.drivers_sources)
env.Prepend(LIBS=[lib])
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index acdc3d52e..efc925dae 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -2,9 +2,9 @@
Import('env')
-if (env["platform"] in ["haiku","osx","windows","x11"]):
+if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
# Thirdparty source files
- if (env["glew"] != "system"): # builtin
+ if (env["glew"] != "system"): # builtin
thirdparty_dir = "#thirdparty/glew/"
thirdparty_sources = [
"glew.c",
@@ -12,10 +12,10 @@ if (env["platform"] in ["haiku","osx","windows","x11"]):
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
- env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
- env.Append(CPPPATH = [thirdparty_dir])
+ env.Append(CPPFLAGS=['-DGLEW_STATIC'])
+ env.Append(CPPPATH=[thirdparty_dir])
- env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
+ env.Append(CPPFLAGS=['-DGLEW_ENABLED'])
# Godot source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 6eabd8901..d3ece6519 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -27,12 +27,12 @@ if (env["libpng"] == "builtin"):
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_png.add_source_files(env.drivers_sources, thirdparty_sources)
- env_png.Append(CPPPATH = [thirdparty_dir])
+ env_png.Append(CPPPATH=[thirdparty_dir])
# Currently .ASM filter_neon.S does not compile on NT.
import os
- if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
- env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"])
+ if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt":
+ env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
env_neon = env_png.Clone();
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
@@ -42,7 +42,7 @@ if (env["libpng"] == "builtin"):
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
env.drivers_sources += neon_sources
else:
- env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"])
+ env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
# Godot source files
env_png.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/rtaudio/SCsub b/drivers/rtaudio/SCsub
index 704c4b674..2b0a60296 100644
--- a/drivers/rtaudio/SCsub
+++ b/drivers/rtaudio/SCsub
@@ -12,7 +12,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
-env.Append(CPPPATH = [thirdparty_dir])
+env.Append(CPPPATH=[thirdparty_dir])
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index fe427e747..3766e782e 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -2,13 +2,13 @@
Import('env')
-g_set_p='#ifdef UNIX_ENABLED\n'
-g_set_p+='#include "os_unix.h"\n'
-g_set_p+='String OS_Unix::get_global_settings_path() const {\n'
-g_set_p+='\treturn "' + env["unix_global_settings_path"]+'";\n'
-g_set_p+='}\n'
-g_set_p+='#endif'
-f = open("os_unix_global_settings_path.cpp","wb")
+g_set_p = '#ifdef UNIX_ENABLED\n'
+g_set_p += '#include "os_unix.h"\n'
+g_set_p += 'String OS_Unix::get_global_settings_path() const {\n'
+g_set_p += '\treturn "' + env["unix_global_settings_path"] + '";\n'
+g_set_p += '}\n'
+g_set_p += '#endif'
+f = open("os_unix_global_settings_path.cpp", "wb")
f.write(g_set_p)
f.close()
diff --git a/drivers/zlib/SCsub b/drivers/zlib/SCsub
index 928128e40..407deb5f6 100644
--- a/drivers/zlib/SCsub
+++ b/drivers/zlib/SCsub
@@ -23,4 +23,4 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
-env.Append(CPPPATH = [thirdparty_dir])
+env.Append(CPPPATH=[thirdparty_dir])
diff --git a/main/SCsub b/main/SCsub
index cd9002de0..a83563f44 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -2,11 +2,11 @@
Import('env')
-env.main_sources=[]
-env.add_source_files(env.main_sources,"*.cpp")
+env.main_sources = []
+env.add_source_files(env.main_sources, "*.cpp")
Export('env')
-lib = env.Library("main",env.main_sources)
+lib = env.Library("main", env.main_sources)
env.Prepend(LIBS=[lib])
diff --git a/methods.py b/methods.py
index 0ede914ae..38dee11a3 100755
--- a/methods.py
+++ b/methods.py
@@ -1,231 +1,231 @@
import os
-def add_source_files(self, sources, filetype, lib_env = None, shared = False):
+def add_source_files(self, sources, filetype, lib_env=None, shared=False):
import glob;
import string;
- #if not lib_objects:
+ # if not lib_objects:
if not lib_env:
lib_env = self
if type(filetype) == type(""):
dir = self.Dir('.').abspath
- list = glob.glob(dir + "/"+filetype)
+ list = glob.glob(dir + "/" + filetype)
for f in list:
- sources.append( self.Object(f) )
+ sources.append(self.Object(f))
else:
for f in filetype:
sources.append(self.Object(f))
-def build_shader_header( target, source, env ):
+def build_shader_header(target, source, env):
for x in source:
print x
name = str(x)
- name = name[ name.rfind("/")+1: ]
- name = name[ name.rfind("\\")+1: ]
- name = name.replace(".","_")
+ name = name[name.rfind("/") + 1:]
+ name = name[name.rfind("\\") + 1:]
+ name = name.replace(".", "_")
- fs = open(str(x),"r")
- fd = open(str(x)+".h","w")
+ fs = open(str(x), "r")
+ fd = open(str(x) + ".h", "w")
fd.write("/* this file has been generated by SCons, do not edit! */\n")
- fd.write("static const char *"+name+"=\n")
- line=fs.readline()
+ fd.write("static const char *" + name + "=\n")
+ line = fs.readline()
while(line):
- line=line.replace("\r","")
- line=line.replace("\n","")
- line=line.replace("\\","\\\\")
- line=line.replace("\"","\\\"")
- fd.write("\""+line+"\\n\"\n")
- line=fs.readline()
+ line = line.replace("\r", "")
+ line = line.replace("\n", "")
+ line = line.replace("\\", "\\\\")
+ line = line.replace("\"", "\\\"")
+ fd.write("\"" + line + "\\n\"\n")
+ line = fs.readline()
fd.write(";\n")
return 0
-def build_glsl_header( filename ):
+def build_glsl_header(filename):
- fs = open(filename,"r")
- line=fs.readline()
+ fs = open(filename, "r")
+ line = fs.readline()
- vertex_lines=[]
- fragment_lines=[]
- uniforms=[]
- attributes=[]
- fbos=[]
- conditionals=[]
- texunits=[]
- texunit_names=[]
- ubos=[]
- ubo_names=[]
+ vertex_lines = []
+ fragment_lines = []
+ uniforms = []
+ attributes = []
+ fbos = []
+ conditionals = []
+ texunits = []
+ texunit_names = []
+ ubos = []
+ ubo_names = []
- reading=""
- line_offset=0
- vertex_offset=0
- fragment_offset=0
+ reading = ""
+ line_offset = 0
+ vertex_offset = 0
+ fragment_offset = 0
while(line):
- if (line.find("[vertex]")!=-1):
- reading="vertex"
- line=fs.readline()
- line_offset+=1
- vertex_offset=line_offset
+ if (line.find("[vertex]") != -1):
+ reading = "vertex"
+ line = fs.readline()
+ line_offset += 1
+ vertex_offset = line_offset
continue
- if (line.find("[fragment]")!=-1):
- reading="fragment"
- line=fs.readline()
- line_offset+=1
- fragment_offset=line_offset
+ if (line.find("[fragment]") != -1):
+ reading = "fragment"
+ line = fs.readline()
+ line_offset += 1
+ fragment_offset = line_offset
continue
- if (line.find("#ifdef ")!=-1):
- ifdefline = line.replace("#ifdef ","").strip()
+ if (line.find("#ifdef ") != -1):
+ ifdefline = line.replace("#ifdef ", "").strip()
if (not ifdefline in conditionals):
- conditionals+=[ifdefline]
+ conditionals += [ifdefline]
- if (line.find("#elif defined(")!=-1):
- ifdefline = line.replace("#elif defined(","").strip()
- ifdefline = ifdefline.replace(")","").strip()
+ if (line.find("#elif defined(") != -1):
+ ifdefline = line.replace("#elif defined(", "").strip()
+ ifdefline = ifdefline.replace(")", "").strip()
if (not ifdefline in conditionals):
- conditionals+=[ifdefline]
+ conditionals += [ifdefline]
import re
if re.search(r"^\s*uniform", line):
- if (line.lower().find("texunit:")!=-1):
- #texture unit
- texunit = str(int( line[line.find(":")+1:].strip() ))
- uline=line[:line.lower().find("//")]
- uline = uline.replace("uniform","");
- uline = uline.replace(";","");
+ if (line.lower().find("texunit:") != -1):
+ # texture unit
+ texunit = str(int(line[line.find(":") + 1:].strip()))
+ uline = line[:line.lower().find("//")]
+ uline = uline.replace("uniform", "");
+ uline = uline.replace(";", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in texunit_names):
- texunits+=[(x,texunit)]
- texunit_names+=[x]
-
- elif (line.lower().find("ubo:")!=-1):
- #ubo
- uboidx = str(int( line[line.find(":")+1:].strip() ))
- uline=line[:line.lower().find("//")]
- uline = uline[uline.find("uniform")+len("uniform"):];
- uline = uline.replace(";","");
- uline = uline.replace("{","");
+ texunits += [(x, texunit)]
+ texunit_names += [x]
+
+ elif (line.lower().find("ubo:") != -1):
+ # ubo
+ uboidx = str(int(line[line.find(":") + 1:].strip()))
+ uline = line[:line.lower().find("//")]
+ uline = uline[uline.find("uniform") + len("uniform"):];
+ uline = uline.replace(";", "");
+ uline = uline.replace("{", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in ubo_names):
- ubos+=[(x,uboidx)]
- ubo_names+=[x]
+ ubos += [(x, uboidx)]
+ ubo_names += [x]
else:
- uline = line.replace("uniform","");
- uline = uline.replace(";","");
+ uline = line.replace("uniform", "");
+ uline = uline.replace(";", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in uniforms):
- uniforms+=[x]
+ 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 ","");
- uline = uline.replace(";","");
- uline = uline[ uline.find(" "): ].strip()
+ 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 ", "");
+ uline = uline.replace(";", "");
+ uline = uline[uline.find(" "):].strip()
- if (uline.find("//")!=-1):
- name,bind = uline.split("//")
- if (bind.find("attrib:")!=-1):
- name=name.strip()
- bind=bind.replace("attrib:","").strip()
- attributes+=[(name,bind)]
+ if (uline.find("//") != -1):
+ name, bind = uline.split("//")
+ if (bind.find("attrib:") != -1):
+ name = name.strip()
+ bind = bind.replace("attrib:", "").strip()
+ attributes += [(name, bind)]
- if (line.strip().find("out ")==0):
- uline = line.replace("out","").strip();
- uline = uline.replace(";","");
- uline = uline[ uline.find(" "): ].strip()
+ if (line.strip().find("out ") == 0):
+ uline = line.replace("out", "").strip();
+ uline = uline.replace(";", "");
+ uline = uline[uline.find(" "):].strip()
- if (uline.find("//")!=-1):
- name,bind = uline.split("//")
- if (bind.find("drawbuffer:")!=-1):
- name=name.strip()
- bind=bind.replace("drawbuffer:","").strip()
- fbos+=[(name,bind)]
+ if (uline.find("//") != -1):
+ name, bind = uline.split("//")
+ if (bind.find("drawbuffer:") != -1):
+ name = name.strip()
+ bind = bind.replace("drawbuffer:", "").strip()
+ fbos += [(name, bind)]
- line=line.replace("\r","")
- line=line.replace("\n","")
- line=line.replace("\\","\\\\")
- line=line.replace("\"","\\\"")
- #line=line+"\\n\\" no need to anymore
+ line = line.replace("\r", "")
+ line = line.replace("\n", "")
+ line = line.replace("\\", "\\\\")
+ line = line.replace("\"", "\\\"")
+ # line=line+"\\n\\" no need to anymore
- if (reading=="vertex"):
- vertex_lines+=[line]
- if (reading=="fragment"):
- fragment_lines+=[line]
+ if (reading == "vertex"):
+ vertex_lines += [line]
+ if (reading == "fragment"):
+ fragment_lines += [line]
- line=fs.readline()
- line_offset+=1
+ line = fs.readline()
+ line_offset += 1
fs.close();
- out_file = filename+".h"
- fd = open(out_file,"w")
+ out_file = filename + ".h"
+ fd = open(out_file, "w")
fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
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: ]
+ 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)
- out_file_ifdef = out_file_base.replace(".","_").upper()
- fd.write("#ifndef "+out_file_ifdef+"\n")
- fd.write("#define "+out_file_ifdef+"\n")
+ out_file_ifdef = out_file_base.replace(".", "_").upper()
+ fd.write("#ifndef " + out_file_ifdef + "\n")
+ fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".glsl.h","").title().replace("_","").replace(".","")+"ShaderGL";
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL";
fd.write("\n\n");
fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n");
- fd.write("class "+out_file_class+" : public ShaderGL {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \""+out_file_class+"\"; }\n");
+ fd.write("class " + out_file_class + " : public ShaderGL {\n\n");
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
fd.write("public:\n\n");
if (len(conditionals)):
fd.write("\tenum Conditionals {\n");
for x in conditionals:
- fd.write("\t\t"+x+",\n");
+ fd.write("\t\t" + x + ",\n");
fd.write("\t};\n\n");
if (len(uniforms)):
fd.write("\tenum Uniforms {\n");
for x in uniforms:
- fd.write("\t\t"+x.upper()+",\n");
+ fd.write("\t\t" + x.upper() + ",\n");
fd.write("\t};\n\n");
fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
@@ -337,7 +337,7 @@ def build_glsl_header( filename ):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\"#define "+x+"\\n\",\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -347,7 +347,7 @@ def build_glsl_header( filename ):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\""+x+"\",\n");
+ fd.write("\t\t\t\"" + x + "\",\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -356,7 +356,7 @@ def build_glsl_header( filename ):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in attributes:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
@@ -366,7 +366,7 @@ def build_glsl_header( filename ):
if (len(fbos)):
fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n")
for x in fbos:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic FBOPair *_fbo_pairs=NULL;\n")
@@ -374,7 +374,7 @@ def build_glsl_header( filename ):
if (len(ubos)):
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
for x in ubos:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
@@ -382,27 +382,27 @@ def build_glsl_header( filename ):
if (len(texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in texunits:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
for x in vertex_lines:
- fd.write("\t\t\t"+x+"\n");
+ fd.write("\t\t\t" + x + "\n");
fd.write("\t\t\";\n\n");
- fd.write("\t\tstatic const int _vertex_code_start="+str(vertex_offset)+";\n")
+ 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");
+ fd.write("\t\t\t" + x + "\n");
fd.write("\t\t\";\n\n");
- fd.write("\t\tstatic const int _fragment_code_start="+str(fragment_offset)+";\n")
+ fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
- fd.write("\t\tsetup(_conditional_strings,"+str(len(conditionals))+",_uniform_strings,"+str(len(uniforms))+",_attribute_pairs,"+str(len(attributes))+",_fbo_pairs,"+str(len(fbos))+",_ubo_pairs,"+str(len(ubos))+",_texunit_pairs,"+str(len(texunits))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ fd.write("\t\tsetup(_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_attribute_pairs," + str(len(attributes)) + ",_fbo_pairs," + str(len(fbos)) + ",_ubo_pairs," + str(len(ubos)) + ",_texunit_pairs," + str(len(texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
fd.write("};\n\n");
@@ -410,7 +410,7 @@ def build_glsl_header( filename ):
fd.close();
-def build_glsl_headers( target, source, env ):
+def build_glsl_headers(target, source, env):
for x in source:
@@ -421,110 +421,110 @@ def build_glsl_headers( target, source, env ):
-def build_hlsl_dx9_header( filename ):
+def build_hlsl_dx9_header(filename):
- fs = open(filename,"r")
- line=fs.readline()
+ fs = open(filename, "r")
+ line = fs.readline()
- vertex_lines=[]
- fragment_lines=[]
- uniforms=[]
- fragment_uniforms=[]
- attributes=[]
- fbos=[]
- conditionals=[]
+ vertex_lines = []
+ fragment_lines = []
+ uniforms = []
+ fragment_uniforms = []
+ attributes = []
+ fbos = []
+ conditionals = []
- reading=""
- line_offset=0
- vertex_offset=0
- fragment_offset=0
+ reading = ""
+ line_offset = 0
+ vertex_offset = 0
+ fragment_offset = 0
while(line):
- if (line.find("[vertex]")!=-1):
- reading="vertex"
- line=fs.readline()
- line_offset+=1
- vertex_offset=line_offset
+ if (line.find("[vertex]") != -1):
+ reading = "vertex"
+ line = fs.readline()
+ line_offset += 1
+ vertex_offset = line_offset
continue
- if (line.find("[fragment]")!=-1):
- reading="fragment"
- line=fs.readline()
- line_offset+=1
- fragment_offset=line_offset
+ if (line.find("[fragment]") != -1):
+ reading = "fragment"
+ line = fs.readline()
+ line_offset += 1
+ fragment_offset = line_offset
continue
- if (line.find("#ifdef ")!=-1):
- ifdefline = line.replace("#ifdef ","").strip()
+ if (line.find("#ifdef ") != -1):
+ ifdefline = line.replace("#ifdef ", "").strip()
if (not ifdefline in conditionals):
- conditionals+=[ifdefline]
+ conditionals += [ifdefline]
- if (line.find("#elif defined(")!=-1):
- ifdefline = line.replace("#elif defined(","").strip()
- ifdefline = ifdefline.replace(")","").strip()
+ if (line.find("#elif defined(") != -1):
+ ifdefline = line.replace("#elif defined(", "").strip()
+ ifdefline = ifdefline.replace(")", "").strip()
if (not ifdefline in conditionals):
- conditionals+=[ifdefline]
- if (line.find("uniform")!=-1):
- uline = line.replace("uniform","");
- uline = uline.replace(";","");
+ conditionals += [ifdefline]
+ if (line.find("uniform") != -1):
+ uline = line.replace("uniform", "");
+ uline = uline.replace(";", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in uniforms):
- uniforms+=[x]
- fragment_uniforms+=[reading=="fragment"]
- line=line.replace("\r","")
- line=line.replace("\n","")
- line=line.replace("\\","\\\\")
- line=line.replace("\"","\\\"")
- line=line+"\\n\\"
-
- if (reading=="vertex"):
- vertex_lines+=[line]
- if (reading=="fragment"):
- fragment_lines+=[line]
-
- line=fs.readline()
- line_offset+=1
+ uniforms += [x]
+ fragment_uniforms += [reading == "fragment"]
+ line = line.replace("\r", "")
+ line = line.replace("\n", "")
+ line = line.replace("\\", "\\\\")
+ line = line.replace("\"", "\\\"")
+ line = line + "\\n\\"
+
+ if (reading == "vertex"):
+ vertex_lines += [line]
+ if (reading == "fragment"):
+ fragment_lines += [line]
+
+ line = fs.readline()
+ line_offset += 1
fs.close();
- out_file = filename+".h"
- fd = open(out_file,"w")
+ out_file = filename + ".h"
+ fd = open(out_file, "w")
fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
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: ]
+ 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)
- out_file_ifdef = out_file_base.replace(".","_").upper()
- fd.write("#ifndef "+out_file_ifdef+"\n")
- fd.write("#define "+out_file_ifdef+"\n")
+ out_file_ifdef = out_file_base.replace(".", "_").upper()
+ fd.write("#ifndef " + out_file_ifdef + "\n")
+ fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".hlsl.h","").title().replace("_","").replace(".","")+"ShaderDX9";
+ out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9";
fd.write("\n\n");
fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n");
- fd.write("class "+out_file_class+" : public ShaderDX9 {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \""+out_file_class+"\"; }\n");
+ fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n");
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
fd.write("public:\n\n");
if (len(conditionals)):
fd.write("\tenum Conditionals {\n");
for x in conditionals:
- fd.write("\t\t"+x+",\n");
+ fd.write("\t\t" + x + ",\n");
fd.write("\t};\n\n");
if (len(uniforms)):
fd.write("\tenum Uniforms {\n");
for x in uniforms:
- fd.write("\t\t"+x.upper()+",\n");
+ fd.write("\t\t" + x.upper() + ",\n");
fd.write("\t};\n\n");
@@ -604,7 +604,7 @@ def build_hlsl_dx9_header( filename ):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\""+x+"\",\n");
+ fd.write("\t\t\t\"" + x + "\",\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -614,7 +614,7 @@ def build_hlsl_dx9_header( filename ):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\""+x+"\",\n");
+ fd.write("\t\t\t\"" + x + "\",\n");
fd.write("\t\t};\n\n");
fd.write("\t\tstatic const bool _fragment_uniforms[]={\n")
@@ -633,20 +633,20 @@ def build_hlsl_dx9_header( filename ):
fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
for x in vertex_lines:
- fd.write("\t\t\t"+x+"\n");
+ fd.write("\t\t\t" + x + "\n");
fd.write("\t\t\";\n\n");
- fd.write("\t\tstatic const int _vertex_code_start="+str(vertex_offset)+";\n")
+ 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");
+ fd.write("\t\t\t" + x + "\n");
fd.write("\t\t\";\n\n");
- fd.write("\t\tstatic const int _fragment_code_start="+str(fragment_offset)+";\n")
+ fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
- fd.write("\t\tsetup(p_device,p_version,_conditional_strings,"+str(len(conditionals))+",_uniform_strings,"+str(len(uniforms))+",_fragment_uniforms,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ fd.write("\t\tsetup(p_device,p_version,_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_fragment_uniforms,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
fd.write("};\n\n");
@@ -654,7 +654,7 @@ def build_hlsl_dx9_header( filename ):
fd.close();
-def build_hlsl_dx9_headers( target, source, env ):
+def build_hlsl_dx9_headers(target, source, env):
for x in source:
@@ -666,154 +666,154 @@ def build_hlsl_dx9_headers( target, source, env ):
class LegacyGLHeaderStruct:
def __init__(self):
- self.vertex_lines=[]
- self.fragment_lines=[]
- self.uniforms=[]
- self.attributes=[]
- self.fbos=[]
- self.conditionals=[]
- self.enums={}
- self.texunits=[]
- self.texunit_names=[]
- self.ubos=[]
- self.ubo_names=[]
-
- self.vertex_included_files=[]
- self.fragment_included_files=[]
-
- self.reading=""
- self.line_offset=0
- 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()
+ self.vertex_lines = []
+ self.fragment_lines = []
+ self.uniforms = []
+ self.attributes = []
+ self.fbos = []
+ self.conditionals = []
+ self.enums = {}
+ self.texunits = []
+ self.texunit_names = []
+ self.ubos = []
+ self.ubo_names = []
+
+ self.vertex_included_files = []
+ self.fragment_included_files = []
+
+ self.reading = ""
+ self.line_offset = 0
+ 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()
while(line):
- if (line.find("[vertex]")!=-1):
- header_data.reading="vertex"
- line=fs.readline()
- header_data.line_offset+=1
- header_data.vertex_offset=header_data.line_offset
+ if (line.find("[vertex]") != -1):
+ header_data.reading = "vertex"
+ line = fs.readline()
+ header_data.line_offset += 1
+ header_data.vertex_offset = header_data.line_offset
continue
- if (line.find("[fragment]")!=-1):
- header_data.reading="fragment"
- line=fs.readline()
- header_data.line_offset+=1
- header_data.fragment_offset=header_data.line_offset
+ if (line.find("[fragment]") != -1):
+ header_data.reading = "fragment"
+ line = fs.readline()
+ header_data.line_offset += 1
+ header_data.fragment_offset = header_data.line_offset
continue
- while(line.find("#include ")!=-1):
- includeline = line.replace("#include ","").strip()[1:-1]
+ while(line.find("#include ") != -1):
+ includeline = line.replace("#include ", "").strip()[1:-1]
import os.path
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
- if (not included_file in header_data.vertex_included_files and header_data.reading=="vertex"):
- header_data.vertex_included_files+=[included_file]
- if(include_file_in_legacygl_header( included_file, header_data, depth + 1 ) == None):
+ if (not included_file in header_data.vertex_included_files and header_data.reading == "vertex"):
+ header_data.vertex_included_files += [included_file]
+ if(include_file_in_legacygl_header(included_file, header_data, depth + 1) == None):
print "Error in file '" + filename + "': #include " + includeline + "could not be found!"
- elif (not included_file in header_data.fragment_included_files and header_data.reading=="fragment"):
- header_data.fragment_included_files+=[included_file]
- if(include_file_in_legacygl_header( included_file, header_data, depth + 1 ) == None):
+ elif (not included_file in header_data.fragment_included_files and header_data.reading == "fragment"):
+ header_data.fragment_included_files += [included_file]
+ if(include_file_in_legacygl_header(included_file, header_data, depth + 1) == None):
print "Error in file '" + filename + "': #include " + includeline + "could not be found!"
- line=fs.readline()
+ line = fs.readline()
- if (line.find("#ifdef ")!=-1 or line.find("#elif defined(")!=-1):
- if (line.find("#ifdef ")!=-1):
- ifdefline = line.replace("#ifdef ","").strip()
+ if (line.find("#ifdef ") != -1 or line.find("#elif defined(") != -1):
+ if (line.find("#ifdef ") != -1):
+ ifdefline = line.replace("#ifdef ", "").strip()
else:
- ifdefline = line.replace("#elif defined(","").strip()
- ifdefline = ifdefline.replace(")","").strip()
+ ifdefline = line.replace("#elif defined(", "").strip()
+ ifdefline = ifdefline.replace(")", "").strip()
- if (line.find("_EN_")!=-1):
+ if (line.find("_EN_") != -1):
enumbase = ifdefline[:ifdefline.find("_EN_")];
- ifdefline = ifdefline.replace("_EN_","_")
- line = line.replace("_EN_","_")
+ ifdefline = ifdefline.replace("_EN_", "_")
+ line = line.replace("_EN_", "_")
# print(enumbase+":"+ifdefline);
if (enumbase not in header_data.enums):
- header_data.enums[enumbase]=[]
+ header_data.enums[enumbase] = []
if (ifdefline not in header_data.enums[enumbase]):
header_data.enums[enumbase].append(ifdefline);
elif (not ifdefline in header_data.conditionals):
- header_data.conditionals+=[ifdefline]
+ header_data.conditionals += [ifdefline]
- if (line.find("uniform")!=-1 and line.lower().find("texunit:")!=-1):
- #texture unit
- texunitstr = line[line.find(":")+1:].strip()
- if (texunitstr=="auto"):
- texunit="-1"
+ if (line.find("uniform") != -1 and line.lower().find("texunit:") != -1):
+ # texture unit
+ texunitstr = line[line.find(":") + 1:].strip()
+ if (texunitstr == "auto"):
+ texunit = "-1"
else:
- texunit = str(int(texunitstr ))
- uline=line[:line.lower().find("//")]
- uline = uline.replace("uniform","");
- uline = uline.replace("highp","");
- uline = uline.replace(";","");
+ texunit = str(int(texunitstr))
+ uline = line[:line.lower().find("//")]
+ uline = uline.replace("uniform", "");
+ uline = uline.replace("highp", "");
+ uline = uline.replace(";", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in header_data.texunit_names):
- header_data.texunits+=[(x,texunit)]
- header_data.texunit_names+=[x]
+ header_data.texunits += [(x, texunit)]
+ header_data.texunit_names += [x]
- elif (line.find("uniform")!=-1):
- uline = line.replace("uniform","");
- uline = uline.replace(";","");
+ elif (line.find("uniform") != -1):
+ uline = line.replace("uniform", "");
+ uline = uline.replace(";", "");
lines = uline.split(",")
for x in lines:
x = x.strip()
- x = x[ x.rfind(" ")+1: ]
- if (x.find("[")!=-1):
- #unfiorm array
- x = x[ :x.find("[") ]
+ x = x[x.rfind(" ") + 1:]
+ if (x.find("[") != -1):
+ # unfiorm array
+ x = x[:x.find("[")]
if (not x in header_data.uniforms):
- header_data.uniforms+=[x]
+ 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 ","");
- uline = uline.replace("highp ","");
- uline = uline.replace(";","");
- uline = uline[ uline.find(" "): ].strip()
+ 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 ", "");
+ uline = uline.replace("highp ", "");
+ uline = uline.replace(";", "");
+ uline = uline[uline.find(" "):].strip()
- if (uline.find("//")!=-1):
- name,bind = uline.split("//")
- if (bind.find("attrib:")!=-1):
- name=name.strip()
- bind=bind.replace("attrib:","").strip()
- header_data.attributes+=[(name,bind)]
+ if (uline.find("//") != -1):
+ name, bind = uline.split("//")
+ if (bind.find("attrib:") != -1):
+ name = name.strip()
+ bind = bind.replace("attrib:", "").strip()
+ header_data.attributes += [(name, bind)]
- line=line.replace("\r","")
- line=line.replace("\n","")
- #line=line.replace("\\","\\\\")
- #line=line.replace("\"","\\\"")
- #line=line+"\\n\\"
+ line = line.replace("\r", "")
+ line = line.replace("\n", "")
+ # line=line.replace("\\","\\\\")
+ # line=line.replace("\"","\\\"")
+ # line=line+"\\n\\"
- if (header_data.reading=="vertex"):
- header_data.vertex_lines+=[line]
- if (header_data.reading=="fragment"):
- header_data.fragment_lines+=[line]
+ if (header_data.reading == "vertex"):
+ header_data.vertex_lines += [line]
+ if (header_data.reading == "fragment"):
+ header_data.fragment_lines += [line]
- line=fs.readline()
- header_data.line_offset+=1
+ line = fs.readline()
+ header_data.line_offset += 1
fs.close();
@@ -821,31 +821,31 @@ def include_file_in_legacygl_header( filename, header_data, depth ):
-def build_legacygl_header( filename, include, class_suffix, output_attribs ):
+def build_legacygl_header(filename, include, class_suffix, output_attribs):
header_data = LegacyGLHeaderStruct()
- include_file_in_legacygl_header( filename, header_data, 0 )
+ include_file_in_legacygl_header(filename, header_data, 0)
- out_file = filename+".h"
- fd = open(out_file,"w")
+ out_file = filename + ".h"
+ fd = open(out_file, "w")
- enum_constants=[]
+ enum_constants = []
fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
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: ]
+ 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)
- 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")
+ 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")
- out_file_class = out_file_base.replace(".glsl.h","").title().replace("_","").replace(".","")+"Shader"+class_suffix;
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix;
fd.write("\n\n");
fd.write("#include \"" + include + "\"\n\n\n");
- 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("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");
@@ -853,14 +853,14 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
if (len(header_data.conditionals)):
fd.write("\tenum Conditionals {\n");
for x in header_data.conditionals:
- fd.write("\t\t"+x.upper()+",\n");
+ 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:
- fd.write("\t\t"+x.upper()+",\n");
+ fd.write("\t\t" + x.upper() + ",\n");
fd.write("\t};\n\n");
fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
@@ -969,47 +969,47 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\tvirtual void init() {\n\n");
- enum_value_count=0;
+ enum_value_count = 0;
if (len(header_data.enums)):
fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n");
fd.write("\t\tstatic const Enum _enums[]={\n")
- bitofs=len(header_data.conditionals)
- enum_vals=[]
+ bitofs = len(header_data.conditionals)
+ enum_vals = []
for xv in header_data.enums:
- x=header_data.enums[xv]
- bits=1
+ x = header_data.enums[xv]
+ bits = 1
amt = len(x);
# print(x)
while(2**bits < amt):
- bits+=1
+ bits += 1
# print("amount: "+str(amt)+" bits "+str(bits));
- strs="{"
+ strs = "{"
for i in range(amt):
- strs+="\"#define "+x[i]+"\\n\","
+ strs += "\"#define " + x[i] + "\\n\","
- v={}
- v["set_mask"]="uint64_t("+str(i)+")<<"+str(bitofs)
- v["clear_mask"]="((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<"+str(bits)+") - 1)<<"+str(bitofs)+")"
+ v = {}
+ v["set_mask"] = "uint64_t(" + str(i) + ")<<" + str(bitofs)
+ v["clear_mask"] = "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")"
enum_vals.append(v)
enum_constants.append(x[i])
- strs+="NULL}"
+ strs += "NULL}"
- fd.write("\t\t\t{(uint64_t(1<<"+str(bits)+")-1)<<"+str(bitofs)+","+str(bitofs)+","+strs+"},\n");
- bitofs+=bits
+ 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")
- enum_value_count=len(enum_vals);
+ enum_value_count = len(enum_vals);
for x in enum_vals:
- fd.write("\t\t\t{"+x["set_mask"]+","+x["clear_mask"]+"},\n");
+ fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n");
fd.write("\t\t};\n\n");
else:
@@ -1021,7 +1021,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(header_data.conditionals)):
for x in header_data.conditionals:
- fd.write("\t\t\t\"#define "+x+"\\n\",\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -1031,7 +1031,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(header_data.uniforms)):
for x in header_data.uniforms:
- fd.write("\t\t\t\""+x+"\",\n");
+ fd.write("\t\t\t\"" + x + "\",\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -1041,7 +1041,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in header_data.attributes:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
@@ -1050,7 +1050,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
if (len(header_data.texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in header_data.texunits:
- fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
fd.write("\t\t};\n\n");
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
@@ -1058,28 +1058,28 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:
for i in range(len(x)):
- fd.write(str(ord(x[i]))+",");
+ fd.write(str(ord(x[i])) + ",");
- fd.write(str(ord('\n'))+",");
+ fd.write(str(ord('\n')) + ",");
fd.write("\t\t0};\n\n");
- fd.write("\t\tstatic const int _vertex_code_start="+str(header_data.vertex_offset)+";\n")
+ 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)):
- fd.write(str(ord(x[i]))+",");
+ fd.write(str(ord(x[i])) + ",");
- fd.write(str(ord('\n'))+",");
+ fd.write(str(ord('\n')) + ",");
fd.write("\t\t0};\n\n");
- fd.write("\t\tstatic const int _fragment_code_start="+str(header_data.fragment_offset)+";\n")
+ fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
if output_attribs:
- fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_attribute_pairs,"+str(len(header_data.attributes))+", _texunit_pairs,"+str(len(header_data.texunits))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str(len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
else:
- fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_texunit_pairs,"+str(len(header_data.texunits))+",_enums,"+str(len(header_data.enums))+",_enum_values,"+str(enum_value_count)+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str(len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str(enum_value_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
@@ -1088,7 +1088,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.write("\tenum EnumConditionals {\n")
for x in enum_constants:
- fd.write("\t\t"+x.upper()+",\n");
+ fd.write("\t\t" + x.upper() + ",\n");
fd.write("\t};\n\n");
fd.write("\tvoid set_enum_conditional(EnumConditionals p_cond) { _set_enum_conditional(p_cond); }\n")
@@ -1098,47 +1098,47 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ):
fd.close();
-def build_legacygl_headers( target, source, env ):
+def build_legacygl_headers(target, source, env):
for x in source:
- build_legacygl_header(str(x), include = "drivers/legacygl/shader_lgl.h", class_suffix = "LGL", output_attribs = False);
+ 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 ):
+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)
+ build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True)
def update_version():
rev = "custom_build"
- if (os.getenv("BUILD_REVISION")!=None):
- rev=os.getenv("BUILD_REVISION")
- print("Using custom revision: "+rev)
+ if (os.getenv("BUILD_REVISION") != None):
+ rev = os.getenv("BUILD_REVISION")
+ 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")
- f.write("#define VERSION_MAJOR "+str(version.major)+"\n")
- f.write("#define VERSION_MINOR "+str(version.minor)+"\n")
+ 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")
+ f.write("#define VERSION_MAJOR " + str(version.major) + "\n")
+ f.write("#define VERSION_MINOR " + str(version.minor) + "\n")
if (hasattr(version, 'patch')):
- f.write("#define VERSION_PATCH "+str(version.patch)+"\n")
- f.write("#define VERSION_REVISION "+str(rev)+"\n")
- f.write("#define VERSION_STATUS "+str(version.status)+"\n")
+ f.write("#define VERSION_PATCH " + str(version.patch) + "\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")
+ f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n")
def parse_cg_file(fname, uniforms, sizes, conditionals):
import re
fs = open(fname, "r")
- line=fs.readline()
+ line = fs.readline()
while line:
@@ -1172,15 +1172,15 @@ def build_cg_shader(sname):
vp_uniform_sizes = []
vp_conditionals = []
- parse_cg_file("vp_"+sname+".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals);
+ parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals);
fp_uniforms = []
fp_uniform_sizes = []
fp_conditionals = []
- parse_cg_file("fp_"+sname+".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals);
+ parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals);
- fd = open("shader_"+sname+".cg.h", "w");
+ fd = open("shader_" + sname + ".cg.h", "w");
fd.write('\n#include "shader_cell.h"\n');
fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n");
@@ -1208,53 +1208,53 @@ def build_cg_shader(sname):
import glob
def detect_modules():
- module_list=[]
- includes_cpp=""
- register_cpp=""
- unregister_cpp=""
+ module_list = []
+ includes_cpp = ""
+ register_cpp = ""
+ unregister_cpp = ""
files = glob.glob("modules/*")
- files.sort() #so register_module_types does not change that often, and also plugins are registered in alphabetic order
+ files.sort() # so register_module_types does not change that often, and also plugins are registered in alphabetic order
for x in files:
if (not os.path.isdir(x)):
continue
- x=x.replace("modules/","") # rest of world
- x=x.replace("modules\\","") # win32
+ x = x.replace("modules/", "") # rest of world
+ x = x.replace("modules\\", "") # win32
module_list.append(x)
try:
- with open("modules/"+x+"/register_types.h"):
- includes_cpp+='#include "modules/'+x+'/register_types.h"\n'
- register_cpp+='#ifdef MODULE_'+x.upper()+'_ENABLED\n'
- register_cpp+='\tregister_'+x+'_types();\n'
- register_cpp+='#endif\n'
- unregister_cpp+='#ifdef MODULE_'+x.upper()+'_ENABLED\n'
- unregister_cpp+='\tunregister_'+x+'_types();\n'
- unregister_cpp+='#endif\n'
+ with open("modules/" + x + "/register_types.h"):
+ includes_cpp += '#include "modules/' + x + '/register_types.h"\n'
+ register_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n'
+ register_cpp += '\tregister_' + x + '_types();\n'
+ register_cpp += '#endif\n'
+ unregister_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n'
+ unregister_cpp += '\tunregister_' + x + '_types();\n'
+ unregister_cpp += '#endif\n'
except IOError:
pass
- modules_cpp="""
+ modules_cpp = """
// modules.cpp - THIS FILE IS GENERATED, DO NOT EDIT!!!!!!!
#include "register_module_types.h"
-"""+includes_cpp+"""
+""" + includes_cpp + """
void register_module_types() {
-"""+register_cpp+"""
+""" + register_cpp + """
}
void unregister_module_types() {
-"""+unregister_cpp+"""
+""" + unregister_cpp + """
}
"""
- f=open("modules/register_module_types.cpp","wb")
+ f = open("modules/register_module_types.cpp", "wb")
f.write(modules_cpp)
return module_list
@@ -1271,7 +1271,7 @@ def win32_spawn(sh, escape, cmd, args, env):
if type(env[e]) != type(""):
env[e] = str(env[e])
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
data, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -1309,48 +1309,48 @@ def win32_spawn(sh, escape, cmd, args, spawnenv):
return exit_code
"""
-def android_add_maven_repository(self,url):
+def android_add_maven_repository(self, url):
self.android_maven_repos.append(url)
-def android_add_dependency(self,depline):
+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
+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
+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
+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
+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):
+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 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"):
- return #not needed, only for windows
+ if (os.name != "nt"):
+ return # not needed, only for windows
# On Windows, due to the limited command line length, when creating a static library
# from a very high number of objects SCons will invoke "ar" once per object file;
@@ -1364,7 +1364,7 @@ def use_windows_spawn_fix(self, platform=None):
import subprocess
- def mySubProcess(cmdline,env):
+ def mySubProcess(cmdline, env):
prefix = ""
if(platform == 'javascript'):
prefix = "python.exe "
@@ -1372,7 +1372,7 @@ def use_windows_spawn_fix(self, platform=None):
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(prefix + cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
data, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -1386,16 +1386,16 @@ def use_windows_spawn_fix(self, platform=None):
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
- rv=0
+ rv = 0
env = {str(key): str(value) for key, value in env.iteritems()}
- if len(cmdline) > 32000 and cmd.endswith("ar") :
+ if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " "
- for i in range(3,len(args)) :
- rv = mySubProcess( cmdline + args[i], env )
- if rv :
+ for i in range(3, len(args)):
+ rv = mySubProcess(cmdline + args[i], env)
+ if rv:
break
else:
- rv = mySubProcess( cmdline, env )
+ rv = mySubProcess(cmdline, env)
return rv
@@ -1435,7 +1435,7 @@ def split_lib(self, libname):
if len(lib_list) > 0:
import os, sys
if os.name == 'posix' and sys.platform == 'msys':
- env.Replace(ARFLAGS = ['rcsT'])
+ env.Replace(ARFLAGS=['rcsT'])
lib = env.Library(libname + "_collated", lib_list)
lib_list = [lib]
@@ -1443,65 +1443,65 @@ def split_lib(self, libname):
env.add_source_files(lib_base, "*.cpp")
lib_list.insert(0, env.Library(libname, lib_base))
- env.Prepend(LIBS = lib_list)
+ env.Prepend(LIBS=lib_list)
-def save_active_platforms(apnames,ap):
+def save_active_platforms(apnames, ap):
for x in ap:
- pth = x+"/logo.png"
+ pth = x + "/logo.png"
# print("open path: "+pth)
- pngf=open(pth,"rb");
- b=pngf.read(1);
- str=" /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
- str+=" static const unsigned char _"+x[9:]+"_logo[]={"
- while(len(b)==1):
- str+=hex(ord(b))
- b=pngf.read(1);
- if (len(b)==1):
- str+=","
-
- str+="};\n"
-
- wf = x+"/logo.h"
- logow = open(wf,"wb")
+ pngf = open(pth, "rb");
+ b = pngf.read(1);
+ str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
+ str += " static const unsigned char _" + x[9:] + "_logo[]={"
+ while(len(b) == 1):
+ str += hex(ord(b))
+ b = pngf.read(1);
+ if (len(b) == 1):
+ str += ","
+
+ str += "};\n"
+
+ wf = x + "/logo.h"
+ logow = open(wf, "wb")
logow.write(str)
-def no_verbose(sys,env):
+def no_verbose(sys, env):
- #If the output is not a terminal, do nothing
+ # If the output is not a terminal, do nothing
if not sys.stdout.isatty():
return
colors = {}
- colors['cyan'] = '\033[96m'
+ colors['cyan'] = '\033[96m'
colors['purple'] = '\033[95m'
- colors['blue'] = '\033[94m'
- colors['green'] = '\033[92m'
+ colors['blue'] = '\033[94m'
+ colors['green'] = '\033[92m'
colors['yellow'] = '\033[93m'
- colors['red'] = '\033[91m'
- colors['end'] = '\033[0m'
+ 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_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] )
+ 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])
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...
@@ -1531,12 +1531,12 @@ def detect_visual_c_compiler_version(tools_env):
# find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
# First test if amd64 and amd64_x86 compilers are present in the path
- vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64;")
+ vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
if(vc_amd64_compiler_detection_index > -1):
vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_str = "amd64"
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64_x86;")
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
if(vc_amd64_x86_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
@@ -1545,14 +1545,14 @@ def detect_visual_c_compiler_version(tools_env):
# Now check the 32 bit compilers
- vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN;")
+ vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
if(vc_x86_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
vc_chosen_compiler_index = vc_x86_compiler_detection_index
vc_chosen_compiler_str = "x86"
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR']+"BIN\\x86_amd64;")
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
if(vc_x86_amd64_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
@@ -1560,11 +1560,11 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_str = "x86_amd64"
# debug help
- #print vc_amd64_compiler_detection_index
- #print vc_amd64_x86_compiler_detection_index
- #print vc_x86_compiler_detection_index
- #print vc_x86_amd64_compiler_detection_index
- #print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str)
+ # print vc_amd64_compiler_detection_index
+ # print vc_amd64_x86_compiler_detection_index
+ # print vc_x86_compiler_detection_index
+ # print vc_x86_amd64_compiler_detection_index
+ # print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str)
return vc_chosen_compiler_str
diff --git a/modules/SCsub b/modules/SCsub
index 76ba91161..4b9c08cf7 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -6,18 +6,18 @@ env_modules = env.Clone()
Export('env_modules')
-env.modules_sources=[
+env.modules_sources = [
"register_module_types.cpp",
]
-#env.add_source_files(env.modules_sources,"*.cpp")
+# env.add_source_files(env.modules_sources,"*.cpp")
Export('env')
for x in env.module_list:
if (x in env.disabled_modules):
continue
- env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"])
- SConscript(x+"/SCsub")
+ env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"])
+ SConscript(x + "/SCsub")
-lib = env_modules.Library("modules",env.modules_sources)
+lib = env_modules.Library("modules", env.modules_sources)
env.Prepend(LIBS=[lib])
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index 14aa59fdb..818810760 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -7,7 +7,7 @@ Import('env_modules')
env_enet = env_modules.Clone()
-if (env["enet"] != "system"): # builtin
+if (env["enet"] != "system"): # builtin
thirdparty_dir = "#thirdparty/enet/"
thirdparty_sources = [
"callbacks.c",
@@ -23,6 +23,6 @@ if (env["enet"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_enet.add_source_files(env.modules_sources, thirdparty_sources)
- env_enet.Append(CPPPATH = [thirdparty_dir])
+ env_enet.Append(CPPPATH=[thirdparty_dir])
env_enet.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub
index 3d19e7c9a..0c5dc66d2 100644
--- a/modules/etc1/SCsub
+++ b/modules/etc1/SCsub
@@ -14,7 +14,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
-env_etc1.Append(CPPPATH = [thirdparty_dir])
+env_etc1.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_etc1.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 0e21deac6..c68c40265 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -5,7 +5,7 @@ Import('env')
# Not building in a separate env as core needs it
# Thirdparty source files
-if (env["freetype"] != "system"): # builtin
+if (env["freetype"] != "system"): # builtin
thirdparty_dir = "#thirdparty/freetype/"
thirdparty_sources = [
"src/autofit/autofit.c",
@@ -56,13 +56,13 @@ if (env["freetype"] != "system"): # builtin
# Include header for WinRT to fix build issues
if "platform" in env and env["platform"] == "winrt":
- env.Append(CCFLAGS = ['/FI', '"modules/freetype/winrtdef.h"'])
+ env.Append(CCFLAGS=['/FI', '"modules/freetype/winrtdef.h"'])
- env.Append(CPPPATH = [thirdparty_dir, thirdparty_dir + "/include"])
+ env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
# also requires libpng headers
- if (env["libpng"] != "system"): # builtin
- env.Append(CPPPATH = ["#thirdparty/libpng"])
+ if (env["libpng"] != "system"): # builtin
+ env.Append(CPPPATH=["#thirdparty/libpng"])
""" FIXME: Remove this commented code if Windows can handle the monolithic lib
# fix for Windows' shell miserably failing on long lines, split in two libraries
@@ -81,10 +81,10 @@ if (env["freetype"] != "system"): # builtin
"""
lib = env.Library("freetype_builtin", thirdparty_sources)
- env.Append(LIBS = [lib])
+ env.Append(LIBS=[lib])
# Godot source files
env.add_source_files(env.modules_sources, "*.cpp")
-env.Append(CCFLAGS = ['-DFREETYPE_ENABLED'])
+env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
Export('env')
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index 1ecc9c0fd..e72dc6a1c 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -14,7 +14,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
-env_jpg.Append(CPPPATH = [thirdparty_dir])
+env_jpg.Append(CPPPATH=[thirdparty_dir])
# Godot's own source files
env_jpg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub
index deadf8687..80d2ab4ab 100644
--- a/modules/mpc/SCsub
+++ b/modules/mpc/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_mpc = env_modules.Clone()
# Thirdparty source files
-if (env["libmpcdec"] != "system"): # builtin
+if (env["libmpcdec"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libmpcdec/"
thirdparty_sources = [
"huffman.c",
@@ -22,7 +22,7 @@ if (env["libmpcdec"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
- env_mpc.Append(CPPPATH = [thirdparty_dir])
+ env_mpc.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_mpc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 3946e5484..719ee4662 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_ogg = env_modules.Clone()
# Thirdparty source files
-if (env["libogg"] != "system"): # builtin
+if (env["libogg"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libogg/"
thirdparty_sources = [
"bitwise.c",
@@ -15,7 +15,7 @@ if (env["libogg"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
- env_ogg.Append(CPPPATH = [thirdparty_dir])
+ env_ogg.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_ogg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index 325816fb1..75ea9b6bd 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_openssl = env_modules.Clone()
# Thirdparty source files
-if (env["openssl"] != "system"): # builtin
+if (env["openssl"] != "system"): # builtin
thirdparty_dir = "#thirdparty/openssl/"
thirdparty_sources = [
@@ -664,15 +664,15 @@ if (env["openssl"] != "system"): # builtin
"crypto/modes",
"openssl",
]
- env_openssl.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ env_openssl.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
- env_openssl.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
+ env_openssl.Append(CPPFLAGS=["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
import os
import methods
- if not (os.name=="nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC
- env_openssl.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"])
+ if not (os.name == "nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC
+ env_openssl.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
# Module sources
@@ -681,7 +681,7 @@ env_openssl.add_source_files(env.modules_sources, "*.c")
# platform/winrt need to know openssl is available, pass to main env
if "platform" in env and env["platform"] == "winrt":
- env.Append(CPPPATH = [thirdparty_dir])
- env.Append(CPPFLAGS = ['-DOPENSSL_ENABLED']);
+ env.Append(CPPPATH=[thirdparty_dir])
+ env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
Export('env')
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index 2cfd439eb..e116fc460 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_opus = env_modules.Clone()
# Thirdparty source files
-if (env["opus"] != "system"): # builtin
+if (env["opus"] != "system"): # builtin
thirdparty_dir = "#thirdparty/opus/"
thirdparty_sources = [
@@ -129,8 +129,8 @@ if (env["opus"] != "system"): # builtin
opus_sources_silk = []
- if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
- env_opus.Append(CFLAGS = ["-DFIXED_POINT"])
+ if("opus_fixed_point" in env and env.opus_fixed_point == "yes"):
+ env_opus.Append(CFLAGS=["-DFIXED_POINT"])
opus_sources_silk = [
"silk/fixed/schur64_FIX.c",
"silk/fixed/residual_energy16_FIX.c",
@@ -205,11 +205,11 @@ if (env["opus"] != "system"): # builtin
"silk/fixed",
"silk/float",
]
- env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
# also requires libogg
- if (env["libogg"] != "system"): # builtin
- env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
+ if (env["libogg"] != "system"): # builtin
+ env_opus.Append(CPPPATH=["#thirdparty/libogg"])
# Module files
env_opus.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index 04a69cfa2..ddca7a794 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -18,7 +18,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
-env_pvr.Append(CPPPATH = [thirdparty_dir])
+env_pvr.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_pvr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index 116fc0bb7..462b6a05c 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_squish = env_modules.Clone()
# Thirdparty source files
-if (env["squish"] != "system"): # builtin
+if (env["squish"] != "system"): # builtin
thirdparty_dir = "#thirdparty/squish/"
thirdparty_sources = [
"alpha.cpp",
@@ -23,7 +23,7 @@ if (env["squish"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_squish.add_source_files(env.modules_sources, thirdparty_sources)
- env_squish.Append(CPPPATH = [thirdparty_dir])
+ env_squish.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_squish.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index cbd19ee6d..ff34b8587 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_theora = env_modules.Clone()
# Thirdparty source files
-if (env["libtheora"] != "system"): # builtin
+if (env["libtheora"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [
#"analyze.c",
@@ -66,18 +66,18 @@ if (env["libtheora"] != "system"): # builtin
thirdparty_sources += thirdparty_sources_x86_vc
if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
- env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"])
+ env_theora.Append(CCFLAGS=["-DOC_X86_ASM"])
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_theora.add_source_files(env.modules_sources, thirdparty_sources)
- env_theora.Append(CPPPATH = [thirdparty_dir])
+ env_theora.Append(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
- if (env["libogg"] != "system"): # builtin
- env_theora.Append(CPPPATH = ["#thirdparty/libogg"])
- if (env["libvorbis"] != "system"): # builtin
- env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"])
+ if (env["libogg"] != "system"): # builtin
+ env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+ if (env["libvorbis"] != "system"): # builtin
+ env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
# Godot source files
env_theora.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 4189e119c..3bd092105 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_vorbis = env_modules.Clone()
# Thirdparty source files
-if (env["libvorbis"] != "system"): # builtin
+if (env["libvorbis"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libvorbis/"
thirdparty_sources = [
#"analysis.c",
@@ -39,11 +39,11 @@ if (env["libvorbis"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
- env_vorbis.Append(CPPPATH = [thirdparty_dir])
+ env_vorbis.Append(CPPPATH=[thirdparty_dir])
# also requires libogg
- if (env["libogg"] != "system"): # builtin
- env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
+ if (env["libogg"] != "system"): # builtin
+ env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
# Godot source files
env_vorbis.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index bb87e7398..c4a707b8e 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -16,17 +16,17 @@ thirdparty_libsimplewebm_sources = [
thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
-env_webm.Append(CPPPATH = [thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
+env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus
-if (env["libogg"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty/libogg"])
-if (env["libvorbis"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty/libvorbis"])
-if (env["opus"] != "system"): # builtin
- env_webm.Append(CPPPATH = ["#thirdparty"])
+if (env["libogg"] != "system"): # builtin
+ env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+if (env["libvorbis"] != "system"): # builtin
+ env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+if (env["opus"] != "system"): # builtin
+ env_webm.Append(CPPPATH=["#thirdparty"])
-if (env["libvpx"] != "system"): # builtin
+if (env["libvpx"] != "system"): # builtin
Export('env_webm')
SConscript("libvpx/SCsub")
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 12e37886f..a7eca29c0 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -248,10 +248,10 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
Import('env')
Import('env_webm')
-env_webm.Append(CPPPATH = [libvpx_dir])
+env_webm.Append(CPPPATH=[libvpx_dir])
env_libvpx = env.Clone()
-env_libvpx.Append(CPPPATH = [libvpx_dir])
+env_libvpx.Append(CPPPATH=[libvpx_dir])
cpu_bits = env["bits"]
osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat')
diff --git a/modules/webm/libvpx/yasm_osx_fat.py b/modules/webm/libvpx/yasm_osx_fat.py
index c39b95c78..0065e2766 100644
--- a/modules/webm/libvpx/yasm_osx_fat.py
+++ b/modules/webm/libvpx/yasm_osx_fat.py
@@ -3,9 +3,9 @@
import sys
import os
-includes = sys.argv[1]
+includes = sys.argv[1]
output_file = sys.argv[2]
-input_file = sys.argv[3]
+input_file = sys.argv[3]
can_remove = {}
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index 57dde509e..ab60bfd6b 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_webp = env_modules.Clone()
# Thirdparty source files
-if (env["libwebp"] != "system"): # builtin
+if (env["libwebp"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [
"enc/webpenc.c",
@@ -115,7 +115,7 @@ if (env["libwebp"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_webp.add_source_files(env.modules_sources, thirdparty_sources)
- env_webp.Append(CPPPATH = [thirdparty_dir])
+ env_webp.Append(CPPPATH=[thirdparty_dir])
# Godot source files
env_webp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 9db6636f8..146f7c25a 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -22,7 +22,7 @@ android_files = [
'java_class_wrapper.cpp'
]
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
+# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#obj = env.SharedObject('godot_android.cpp')
@@ -30,86 +30,86 @@ env_android = env.Clone()
if env['target'] == "profile":
env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
-android_objects=[]
+android_objects = []
for x in android_files:
- android_objects.append( env_android.SharedObject( x ) )
+ android_objects.append(env_android.SharedObject(x))
prog = None
-abspath=env.Dir(".").abspath
+abspath = env.Dir(".").abspath
-gradle_basein = open(abspath+"/build.gradle.template","rb")
-gradle_baseout = open(abspath+"/java/build.gradle","wb")
+gradle_basein = open(abspath + "/build.gradle.template", "rb")
+gradle_baseout = open(abspath + "/java/build.gradle", "wb")
gradle_text = gradle_basein.read()
-gradle_maven_repos_text=""
+gradle_maven_repos_text = ""
if len(env.android_maven_repos) > 0:
- gradle_maven_repos_text+="maven {\n"
+ gradle_maven_repos_text += "maven {\n"
for x in env.android_maven_repos:
- gradle_maven_repos_text+="\t\t"+x+"\n"
- gradle_maven_repos_text+="\t}\n"
+ gradle_maven_repos_text += "\t\t" + x + "\n"
+ gradle_maven_repos_text += "\t}\n"
-gradle_maven_dependencies_text=""
+gradle_maven_dependencies_text = ""
for x in env.android_dependencies:
- gradle_maven_dependencies_text+=x+"\n"
+ gradle_maven_dependencies_text += x + "\n"
-gradle_java_dirs_text=""
+gradle_java_dirs_text = ""
for x in env.android_java_dirs:
- gradle_java_dirs_text+=",'"+x.replace("\\","/")+"'"
+ gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'"
-gradle_res_dirs_text=""
+gradle_res_dirs_text = ""
for x in env.android_res_dirs:
- gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'"
+ gradle_res_dirs_text += ",'" + x.replace("\\", "/") + "'"
-gradle_aidl_dirs_text=""
+gradle_aidl_dirs_text = ""
for x in env.android_aidl_dirs:
- gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'"
+ gradle_aidl_dirs_text += ",'" + x.replace("\\", "/") + "'"
-gradle_jni_dirs_text=""
+gradle_jni_dirs_text = ""
for x in env.android_jni_dirs:
- gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'"
+ gradle_jni_dirs_text += ",'" + x.replace("\\", "/") + "'"
-gradle_asset_dirs_text=""
+gradle_asset_dirs_text = ""
-gradle_default_config_text=""
+gradle_default_config_text = ""
for x in env.android_default_config:
- gradle_default_config_text+=x+"\n\t\t"
+ gradle_default_config_text += x + "\n\t\t"
-gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text)
-gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text)
-gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$",gradle_aidl_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$",gradle_jni_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$",gradle_default_config_text)
+gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$", gradle_maven_repos_text)
+gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$", gradle_maven_dependencies_text)
+gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$", gradle_java_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$", gradle_res_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text)
-gradle_baseout.write( gradle_text )
+gradle_baseout.write(gradle_text)
gradle_baseout.close()
-pp_basein = open(abspath+"/AndroidManifest.xml.template","rb")
-pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb")
+pp_basein = open(abspath + "/AndroidManifest.xml.template", "rb")
+pp_baseout = open(abspath + "/java/AndroidManifest.xml", "wb")
manifest = pp_basein.read()
-manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk)
-manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk)
-manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk)
-pp_baseout.write( manifest )
+manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
+manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
+manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk)
+pp_baseout.write(manifest)
-env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"])
+env_android.SharedLibrary("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
lib_arch_dir = ''
@@ -125,8 +125,8 @@ else:
if lib_arch_dir != '':
if env['target'] == 'release':
lib_type_dir = 'release'
- else: # release_debug, debug
+ else: # release_debug, debug
lib_type_dir = 'debug'
- out_dir = '#platform/android/java/libs/'+lib_type_dir+'/'+lib_arch_dir
- env_android.Command(out_dir+'/libgodot_android.so', '#bin/libgodot'+env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
+ out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
+ env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 9a1445286..f1331d24d 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -21,12 +21,12 @@ def get_opts():
return [
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
- ('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
- ('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")),
- ('ndk_platform', 'compile for platform: (android- , example: android-14)',"android-14"),
- ('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"),
- ('android_neon','enable neon (armv7 only)',"yes"),
- ('android_stl','enable STL support in android port (for modules)',"no")
+ ('NDK_TARGET', 'toolchain to use for the NDK', os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
+ ('NDK_TARGET_X86', 'toolchain to use for the NDK x86', os.environ.get("NDK_TARGET_X86", "x86-4.9")),
+ ('ndk_platform', 'compile for platform: (android- , example: android-14)', "android-14"),
+ ('android_arch', 'select compiler architecture: (armv7/armv6/x86)', "armv7"),
+ ('android_neon', 'enable neon (armv7 only)', "yes"),
+ ('android_stl', 'enable STL support in android port (for modules)', "no")
]
@@ -34,7 +34,7 @@ def get_flags():
return [
('tools', 'no'),
- ('openssl', 'builtin'), #use builtin openssl
+ ('openssl', 'builtin'), # use builtin openssl
]
@@ -52,16 +52,16 @@ def configure(env):
# Workaround for MinGW. See:
# http://www.scons.org/wiki/LongCmdLinesOnWin32
import os
- if (os.name=="nt"):
+ if (os.name == "nt"):
import subprocess
- def mySubProcess(cmdline,env):
- #print "SPAWNED : " + cmdline
+ def mySubProcess(cmdline, env):
+ # print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
data, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -75,176 +75,176 @@ def configure(env):
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
- rv=0
- if len(cmdline) > 32000 and cmd.endswith("ar") :
+ rv = 0
+ if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " "
- for i in range(3,len(args)) :
- rv = mySubProcess( cmdline + args[i], env )
- if rv :
+ for i in range(3, len(args)):
+ rv = mySubProcess(cmdline + args[i], env)
+ if rv:
break
else:
- rv = mySubProcess( cmdline, env )
+ rv = mySubProcess(cmdline, env)
return rv
env['SPAWN'] = mySpawn
- ndk_platform=env['ndk_platform']
+ ndk_platform = env['ndk_platform']
- if env['android_arch'] not in ['armv7','armv6','x86']:
- env['android_arch']='armv7'
+ if env['android_arch'] not in ['armv7', 'armv6', 'x86']:
+ env['android_arch'] = 'armv7'
- if env['android_arch']=='x86':
- env['NDK_TARGET']=env['NDK_TARGET_X86']
- env["x86_libtheora_opt_gcc"]=True
+ if env['android_arch'] == 'x86':
+ env['NDK_TARGET'] = env['NDK_TARGET_X86']
+ env["x86_libtheora_opt_gcc"] = True
if env['PLATFORM'] == 'win32':
env.Tool('gcc')
env['SHLIBSUFFIX'] = '.so'
- neon_text=""
- if env["android_arch"]=="armv7" and env['android_neon']=='yes':
- neon_text=" (with neon)"
- print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
+ neon_text = ""
+ if env["android_arch"] == "armv7" and env['android_neon'] == 'yes':
+ neon_text = " (with neon)"
+ print("Godot Android!!!!! (" + env['android_arch'] + ")" + neon_text)
env.Append(CPPPATH=['#platform/android'])
- if env['android_arch']=='x86':
- env.extra_suffix=".x86"+env.extra_suffix
- elif env['android_arch']=='armv6':
- env.extra_suffix=".armv6"+env.extra_suffix
- elif env["android_arch"]=="armv7":
- if env['android_neon']=='yes':
- env.extra_suffix=".armv7.neon"+env.extra_suffix
+ if env['android_arch'] == 'x86':
+ env.extra_suffix = ".x86" + env.extra_suffix
+ elif env['android_arch'] == 'armv6':
+ env.extra_suffix = ".armv6" + env.extra_suffix
+ elif env["android_arch"] == "armv7":
+ if env['android_neon'] == 'yes':
+ env.extra_suffix = ".armv7.neon" + env.extra_suffix
else:
- env.extra_suffix=".armv7"+env.extra_suffix
+ env.extra_suffix = ".armv7" + env.extra_suffix
- gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
+ gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/";
if (sys.platform.startswith("linux")):
if (platform.machine().endswith('64')):
- gcc_path=gcc_path+"/linux-x86_64/bin"
+ gcc_path = gcc_path + "/linux-x86_64/bin"
else:
- gcc_path=gcc_path+"/linux-x86/bin"
+ gcc_path = gcc_path + "/linux-x86/bin"
elif (sys.platform.startswith("darwin")):
- gcc_path=gcc_path+"/darwin-x86_64/bin"
+ gcc_path = gcc_path + "/darwin-x86_64/bin"
env['SHLINKFLAGS'][1] = '-shared'
env['SHLIBSUFFIX'] = '.so'
elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')):
- gcc_path=gcc_path+"/windows-x86_64/bin"
+ gcc_path = gcc_path + "/windows-x86_64/bin"
else:
- gcc_path=gcc_path+"/windows-x86/bin"
-
- env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
- if env['android_arch']=='x86':
- env['CC'] = gcc_path+'/i686-linux-android-gcc'
- env['CXX'] = gcc_path+'/i686-linux-android-g++'
- env['AR'] = gcc_path+"/i686-linux-android-ar"
- env['RANLIB'] = gcc_path+"/i686-linux-android-ranlib"
- env['AS'] = gcc_path+"/i686-linux-android-as"
+ gcc_path = gcc_path + "/windows-x86/bin"
+
+ env['ENV']['PATH'] = gcc_path + ":" + env['ENV']['PATH']
+ if env['android_arch'] == 'x86':
+ env['CC'] = gcc_path + '/i686-linux-android-gcc'
+ env['CXX'] = gcc_path + '/i686-linux-android-g++'
+ env['AR'] = gcc_path + "/i686-linux-android-ar"
+ env['RANLIB'] = gcc_path + "/i686-linux-android-ranlib"
+ env['AS'] = gcc_path + "/i686-linux-android-as"
else:
- env['CC'] = gcc_path+'/arm-linux-androideabi-gcc'
- env['CXX'] = gcc_path+'/arm-linux-androideabi-g++'
- env['AR'] = gcc_path+"/arm-linux-androideabi-ar"
- env['RANLIB'] = gcc_path+"/arm-linux-androideabi-ranlib"
- env['AS'] = gcc_path+"/arm-linux-androideabi-as"
+ env['CC'] = gcc_path + '/arm-linux-androideabi-gcc'
+ env['CXX'] = gcc_path + '/arm-linux-androideabi-g++'
+ env['AR'] = gcc_path + "/arm-linux-androideabi-ar"
+ env['RANLIB'] = gcc_path + "/arm-linux-androideabi-ranlib"
+ env['AS'] = gcc_path + "/arm-linux-androideabi-as"
- if env['android_arch']=='x86':
+ if env['android_arch'] == 'x86':
env['ARCH'] = 'arch-x86'
else:
env['ARCH'] = 'arch-arm'
import string
- #include path
- gcc_include=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] +"/usr/include"
- ld_sysroot=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']
- #glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue"
- ld_path=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']+"/usr/lib"
+ # include path
+ gcc_include = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/include"
+ ld_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH']
+ # glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue"
+ ld_path = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/lib"
env.Append(CPPPATH=[gcc_include])
# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
- env['neon_enabled']=False
- if env['android_arch']=='x86':
+ env['neon_enabled'] = False
+ if env['android_arch'] == 'x86':
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
- elif env["android_arch"]=="armv6":
+ elif env["android_arch"] == "armv6":
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
- elif env["android_arch"]=="armv7":
+ elif env["android_arch"] == "armv7":
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
- if env['android_neon']=='yes':
- env['neon_enabled']=True
- env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])
+ if env['android_neon'] == 'yes':
+ env['neon_enabled'] = True
+ env.Append(CCFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
else:
env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
env.Append(LDPATH=[ld_path])
env.Append(LIBS=['OpenSLES'])
# env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android'])
- env.Append(LIBS=['EGL','OpenSLES','android'])
- env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2', 'z'])
+ env.Append(LIBS=['EGL', 'OpenSLES', 'android'])
+ env.Append(LIBS=['c', 'm', 'stdc++', 'log', 'GLESv1_CM', 'GLESv2', 'z'])
- env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
+ env["LINKFLAGS"] = string.split(" -g --sysroot=" + ld_sysroot + " -Wl,--no-undefined -Wl,-z,noexecstack ")
env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer'])
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2', '-ffast-math','-DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
- env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT'])
+ env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
# TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
- if (env["android_arch"]=="armv6" or env["android_arch"]=="armv7"):
+ if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
- env.opus_fixed_point="yes"
-
- if (env['android_stl']=='yes'):
- #env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"])
- if env['android_arch']=='x86':
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
- elif env['android_arch']=='armv6':
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
- elif env["android_arch"]=="armv7":
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
-
- env.Append(LIBS=["gnustl_static","supc++"])
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
-
- #env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"])
- #env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"])
- #env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
+ env.opus_fixed_point = "yes"
+
+ if (env['android_stl'] == 'yes'):
+ # env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
+ if env['android_arch'] == 'x86':
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
+ elif env['android_arch'] == 'armv6':
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
+ elif env["android_arch"] == "armv7":
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
+
+ env.Append(LIBS=["gnustl_static", "supc++"])
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
+
+ # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"])
+ # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"])
+ # env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
else:
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"])
- env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
- if env['android_arch']=='x86':
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
- elif env["android_arch"]=="armv6":
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
- elif env["android_arch"]=="armv7":
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
+ env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
+ if env['android_arch'] == 'x86':
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
+ elif env["android_arch"] == "armv6":
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
+ elif env["android_arch"] == "armv7":
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
env.Append(LIBS=['gnustl_static'])
- env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST'])
+ 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') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
env.use_windows_spawn_fix()
diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py
index 76ccbe3af..ed320bebc 100644
--- a/platform/bb10/detect.py
+++ b/platform/bb10/detect.py
@@ -53,7 +53,7 @@ def configure(env):
env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
env['PROGSUFFIX'] = ".qnx.${qnx_target}"
- print("PROGSUFFIX: "+env['PROGSUFFIX']+" target: "+env['qnx_target'])
+ print("PROGSUFFIX: " + env['PROGSUFFIX'] + " target: " + env['qnx_target'])
env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
@@ -66,23 +66,23 @@ def configure(env):
env['AR'] = '$qnx_prefix-ar'
env['RANLIB'] = '$qnx_prefix-ranlib'
- env.Append(CPPPATH = ['#platform/bb10'])
- env.Append(LIBPATH = ['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
- env.Append(CCFLAGS = string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
- if env['bb10_exceptions']=="yes":
- env.Append(CCFLAGS = ['-fexceptions'])
+ env.Append(CPPPATH=['#platform/bb10'])
+ env.Append(LIBPATH=['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
+ env.Append(CCFLAGS=string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
+ if env['bb10_exceptions'] == "yes":
+ env.Append(CCFLAGS=['-fexceptions'])
else:
- env.Append(CCFLAGS = ['-fno-exceptions'])
+ env.Append(CCFLAGS=['-fno-exceptions'])
- #env.Append(LINKFLAGS = string.split()
+ # env.Append(LINKFLAGS = string.split()
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O3','-DRELEASE_BUILD'])
+ env.Append(CCFLAGS=['-O3', '-DRELEASE_BUILD'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g', '-O0','-DDEBUG_ENABLED', '-D_DEBUG'])
+ env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED', '-D_DEBUG'])
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 bac287ef6..23e5e2e71 100644
--- a/platform/haiku/SCsub
+++ b/platform/haiku/SCsub
@@ -20,7 +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):
+def addResourcesAction(target=None, source=None, env=None):
return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
env.AddPostAction(target, addResourcesAction)
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index aef423b40..e64be0a18 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -18,7 +18,7 @@ def can_build():
def get_opts():
return [
- ('debug_release', 'Add debug symbols to release version','no')
+ ('debug_release', 'Add debug symbols to release version', 'no')
]
def get_flags():
@@ -28,34 +28,34 @@ def get_flags():
def configure(env):
is64 = sys.maxsize > 2**32
- if (env["bits"]=="default"):
+ if (env["bits"] == "default"):
if (is64):
- env["bits"]="64"
+ env["bits"] = "64"
else:
- env["bits"]="32"
+ env["bits"] = "32"
- env.Append(CPPPATH = ['#platform/haiku'])
+ env.Append(CPPPATH=['#platform/haiku'])
env["CC"] = "gcc-x86"
env["CXX"] = "g++-x86"
- if (env["target"]=="release"):
- if (env["debug_release"]=="yes"):
+ if (env["target"] == "release"):
+ if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2'])
else:
- env.Append(CCFLAGS=['-O3','-ffast-math'])
- elif (env["target"]=="release_debug"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
- #env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- env.Append(CPPFLAGS = ['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
- env.Append(CPPFLAGS = ['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
- env.Append(CPPFLAGS = ['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
- env.Append(LIBS = ['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
+ env.Append(CCFLAGS=['-O3', '-ffast-math'])
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ elif (env["target"] == "debug"):
+ env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+ # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
+ env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
+ env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
+ env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
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')})
- env.Append(BUILDERS = {'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl')})
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 1d7797ebd..7e71faa37 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -19,7 +19,7 @@ iphone_lib = [
'ios.mm',
]
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
+# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#iphone_lib = env.Library('iphone', iphone_lib)
@@ -30,7 +30,7 @@ if env['ios_gles22_override'] == "yes":
env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
-#if env['ios_appirater'] == "yes":
+# if env['ios_appirater'] == "yes":
# env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED'])
@@ -38,5 +38,5 @@ obj = env_ios.Object('godot_iphone.cpp')
prog = None
prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
-action = "$IPHONEPATH/usr/bin/dsymutil "+File(prog)[0].path+" -o " + File(prog)[0].path + ".dSYM"
+action = "$IPHONEPATH/usr/bin/dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM"
env.AddPostAction(prog, action)
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index cea79d0f2..541487d58 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -39,7 +39,7 @@ def get_flags():
('tools', 'no'),
('webp', 'yes'),
('builtin_zlib', 'yes'),
- ('openssl','builtin'), #use builtin openssl
+ ('openssl', 'builtin'), # use builtin openssl
]
@@ -48,7 +48,7 @@ def configure(env):
env.Append(CPPPATH=['#platform/iphone'])
- env['ENV']['PATH'] = env['IPHONEPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH']
+ env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
@@ -56,21 +56,21 @@ def configure(env):
env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
import string
- if (env["ios_sim"]=="yes" or env["arch"] == "x86"): # i386, simulator
- env["arch"]="x86"
- env["bits"]="32"
+ if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator
+ env["arch"] = "x86"
+ env["bits"] = "32"
env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
- elif (env["arch"]=="arm64"): # arm64
+ elif (env["arch"] == "arm64"): # arm64
env["bits"] = "64"
env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
- else: # armv7
+ else: # armv7
env["arch"] = "arm"
env["bits"] = "32"
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
- if (env["arch"]=="x86"):
+ if (env["arch"] == "x86"):
env['IPHONEPLATFORM'] = 'iPhoneSimulator'
env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
'-isysroot', '$IPHONESDK',
@@ -92,7 +92,7 @@ def configure(env):
'-framework', 'SystemConfiguration',
'-F$IPHONESDK',
])
- elif (env["arch"]=="arm64"):
+ elif (env["arch"] == "arm64"):
env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
'-isysroot', '$IPHONESDK',
#'-stdlib=libc++',
@@ -139,39 +139,39 @@ def configure(env):
if env['icloud'] == 'yes':
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
- env.Append(CPPPATH = ['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
+ env.Append(CPPPATH=['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
- env.Append(LINKFLAGS=['-O3']) #
+ env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-gdwarf-2']) # removed -ffast-math
+ env.Append(LINKFLAGS=['-O3'])
elif env["target"] == "release_debug":
- env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['-Os'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
- elif (env["target"]=="profile"):
+ elif (env["target"] == "profile"):
- env.Append(CCFLAGS=['-g','-pg', '-Os'])
+ env.Append(CCFLAGS=['-g', '-pg', '-Os'])
env.Append(LINKFLAGS=['-pg'])
- if (env["ios_sim"]=="yes"): #TODO: Check if needed?
+ if (env["ios_sim"] == "yes"): # TODO: Check if needed?
env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
# TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
- env.opus_fixed_point="yes"
- if env["arch"]=="x86":
+ env.opus_fixed_point = "yes"
+ if env["arch"] == "x86":
pass
- elif(env["arch"]=="arm64"):
+ elif(env["arch"] == "arm64"):
env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
else:
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
@@ -180,10 +180,10 @@ def configure(env):
env.Append(CPPFLAGS=['-fexceptions'])
else:
env.Append(CPPFLAGS=['-fno-exceptions'])
- #env['neon_enabled']=True
+ # env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
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') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index 07852ac20..5d5cd1590 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -14,24 +14,24 @@ env_javascript = env.Clone()
if env['target'] == "profile":
env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
-javascript_objects=[]
+javascript_objects = []
for x in javascript_files:
- javascript_objects.append( env_javascript.Object( x ) )
+ javascript_objects.append(env_javascript.Object(x))
-env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
-env.Append(LINKFLAGS=["--shell-file",'"platform/javascript/godot_shell.html"'])
+env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
+env.Append(LINKFLAGS=["--shell-file", '"platform/javascript/godot_shell.html"'])
-build = env.Program('#bin/godot',javascript_objects,PROGSUFFIX=env["PROGSUFFIX"]+".html")
+build = env.Program('#bin/godot', javascript_objects, PROGSUFFIX=env["PROGSUFFIX"] + ".html")
def make_html_shell(target, source, env):
- html_path = target[0].rstr()
- assert html_path[:4] == 'bin/'
- assert html_path[-5:] == '.html'
- basename = html_path[4:-5]
- with open(html_path, 'r+') as html_file:
- fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
- html_file.seek(0)
- html_file.truncate()
- html_file.write(fixed_html)
+ html_path = target[0].rstr()
+ assert html_path[:4] == 'bin/'
+ assert html_path[-5:] == '.html'
+ basename = html_path[4:-5]
+ with open(html_path, 'r+') as html_file:
+ fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
+ html_file.seek(0)
+ html_file.truncate()
+ html_file.write(fixed_html)
env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file"))
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index ce6149c25..56b41a49a 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -18,8 +18,8 @@ def can_build():
def get_opts():
return [
- ['wasm','Compile to WebAssembly','no'],
- ['javascript_eval','Enable JavaScript eval interface','yes'],
+ ['wasm', 'Compile to WebAssembly', 'no'],
+ ['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
]
def get_flags():
@@ -40,13 +40,13 @@ def configure(env):
env.Append(CPPPATH=['#platform/javascript'])
- em_path=os.environ["EMSCRIPTEN_ROOT"]
+ em_path = os.environ["EMSCRIPTEN_ROOT"]
- env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH']
- env['CC'] = em_path+'/emcc'
- env['CXX'] = em_path+'/emcc'
+ env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
+ env['CC'] = em_path + '/emcc'
+ env['CXX'] = em_path + '/emcc'
#env['AR'] = em_path+"/emar"
- env['AR'] = em_path+"/emcc"
+ env['AR'] = em_path + "/emcc"
env['ARFLAGS'] = "-o"
# env['RANLIB'] = em_path+"/emranlib"
@@ -60,11 +60,11 @@ def configure(env):
# env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2'])
- elif (env["target"]=="release_debug"):
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
#env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
@@ -73,33 +73,33 @@ def configure(env):
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
env.opus_fixed_point = "yes"
- env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
- env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS'])
+ env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
+ env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
- env.Append(CPPFLAGS=['-s','FULL_ES2=1'])
+ env.Append(CPPFLAGS=['-s', 'FULL_ES2=1'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
if env['wasm'] == 'yes':
- env.Append(LINKFLAGS=['-s','BINARYEN=1'])
- env.Append(LINKFLAGS=['-s','\'BINARYEN_METHOD="native-wasm"\''])
- env["PROGSUFFIX"]+=".webassembly"
+ env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+ env.Append(LINKFLAGS=['-s', '\'BINARYEN_METHOD="native-wasm"\''])
+ env["PROGSUFFIX"] += ".webassembly"
else:
- env.Append(CPPFLAGS=['-s','ASM_JS=1'])
- env.Append(LINKFLAGS=['-s','ASM_JS=1'])
+ env.Append(CPPFLAGS=['-s', 'ASM_JS=1'])
+ env.Append(LINKFLAGS=['-s', 'ASM_JS=1'])
if env['javascript_eval'] == 'yes':
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
env.Append(LINKFLAGS=['-O2'])
- #env.Append(LINKFLAGS=['-g4'])
+ # env.Append(LINKFLAGS=['-g4'])
- #print "CCCOM is:", env.subst('$CCCOM')
- #print "P: ", env['p'], " Platofrm: ", env['platform']
+ # print "CCCOM is:", env.subst('$CCCOM')
+ # print "P: ", env['p'], " Platofrm: ", env['platform']
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') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index 68484b728..c8e0e1761 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -12,4 +12,4 @@ files = [
'joystick_osx.cpp',
]
-env.Program('#bin/godot',files)
+env.Program('#bin/godot', files)
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 358c4ef01..ddb27742a 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -20,8 +20,8 @@ def can_build():
def get_opts():
return [
- ('force_64_bits','Force 64 bits binary','no'),
- ('osxcross_sdk','OSXCross SDK version','darwin14'),
+ ('force_64_bits', 'Force 64 bits binary', 'no'),
+ ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
]
@@ -36,67 +36,67 @@ def configure(env):
env.Append(CPPPATH=['#platform/osx'])
- if (env["bits"]=="default"):
- env["bits"]="32"
+ if (env["bits"] == "default"):
+ env["bits"] = "32"
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2'])
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ 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"):
+ # regular native build
+ if (env["bits"] == "64"):
env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'x86_64'])
- elif (env["bits"]=="32"):
+ elif (env["bits"] == "32"):
env.Append(CCFLAGS=['-arch', 'i386'])
env.Append(LINKFLAGS=['-arch', 'i386'])
else:
env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
else:
- #osxcross build
- root=os.environ.get("OSXCROSS_ROOT",0)
- if env["bits"]=="64":
- basecmd=root+"/target/bin/x86_64-apple-"+env["osxcross_sdk"]+"-"
+ # osxcross build
+ root = os.environ.get("OSXCROSS_ROOT", 0)
+ if env["bits"] == "64":
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
else:
- basecmd=root+"/target/bin/i386-apple-"+env["osxcross_sdk"]+"-"
+ 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['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(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
env.Append(LIBS=['pthread'])
#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
- env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+ env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
- if (env["CXX"]=="clang++"):
+ if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env["CC"]="clang"
- env["LD"]="clang++"
+ env["CC"] = "clang"
+ env["LD"] = "clang++"
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') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env["x86_libtheora_opt_gcc"]=True
+ env["x86_libtheora_opt_gcc"] = True
diff --git a/platform/server/SCsub b/platform/server/SCsub
index d53a00328..30195bb90 100644
--- a/platform/server/SCsub
+++ b/platform/server/SCsub
@@ -3,8 +3,8 @@
Import('env')
-common_server=[\
+common_server = [\
"os_server.cpp",\
]
-env.Program('#bin/godot_server',['godot_server.cpp']+common_server)
+env.Program('#bin/godot_server', ['godot_server.cpp'] + common_server)
diff --git a/platform/server/detect.py b/platform/server/detect.py
index c6e9d45f9..9d23ceda7 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -12,16 +12,16 @@ def get_name():
def can_build():
- if (os.name!="posix"):
+ if (os.name != "posix"):
return False
- return True # enabled
+ return True # enabled
def get_opts():
return [
- ('use_llvm','Use llvm compiler','no'),
- ('force_32_bits','Force 32 bits binary','no')
+ ('use_llvm', 'Use llvm compiler', 'no'),
+ ('force_32_bits', 'Force 32 bits binary', 'no')
]
def get_flags():
@@ -34,43 +34,43 @@ def get_flags():
def configure(env):
env.Append(CPPPATH=['#platform/server'])
- if (env["use_llvm"]=="yes"):
- env["CC"]="clang"
- env["CXX"]="clang++"
- env["LD"]="clang++"
+ if (env["use_llvm"] == "yes"):
+ env["CC"] = "clang"
+ env["CXX"] = "clang++"
+ env["LD"] = "clang++"
- is64=sys.maxsize > 2**32
+ is64 = sys.maxsize > 2**32
- if (env["bits"]=="default"):
+ if (env["bits"] == "default"):
if (is64):
- env["bits"]="64"
+ env["bits"] = "64"
else:
- env["bits"]="32"
+ env["bits"] = "32"
- #if (env["tools"]=="no"):
+ # if (env["tools"]=="no"):
# #no tools suffix
# env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
# env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
- env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
- env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
+ env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
+ env.Append(LIBS=['pthread', 'z']) # TODO detect linux/BSD!
- if (env["CXX"]=="clang++"):
+ if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env["CC"]="clang"
- env["LD"]="clang++"
+ env["CC"] = "clang"
+ env["LD"] = "clang++"
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 00568952e..32c23b906 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -3,7 +3,7 @@
Import('env')
-common_win=[
+common_win = [
"context_gl_win.cpp",
"os_windows.cpp",
"ctxgl_procaddr.cpp",
@@ -14,16 +14,16 @@ common_win=[
"joystick.cpp",
]
-restarget="godot_res"+env["OBJSUFFIX"]
+restarget = "godot_res" + env["OBJSUFFIX"]
-obj = env.RES(restarget,'godot_res.rc')
+obj = env.RES(restarget, 'godot_res.rc')
common_win.append(obj)
-env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"])
+env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
-if (env['vsproj'])=="yes":
+if (env['vsproj']) == "yes":
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 325f2838b..4bb6dc4a9 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -85,7 +85,7 @@
#####
# TODO :
-#
+#
# - finish to cleanup this script to remove all the remains of previous hacks and workarounds
# - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
# - confirm it works well with other Visual Studio versions.
@@ -107,21 +107,21 @@ def get_name():
def can_build():
- if (os.name=="nt"):
- #building natively on windows!
- if ( os.getenv("VCINSTALLDIR") ):
+ if (os.name == "nt"):
+ # building natively on windows!
+ if (os.getenv("VCINSTALLDIR")):
return True
else:
print("\nMSVC not detected, attempting Mingw.")
mingw32 = ""
mingw64 = ""
- if ( os.getenv("MINGW32_PREFIX") ) :
+ if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX")
- if ( os.getenv("MINGW64_PREFIX") ) :
+ if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > NUL 2>&1"
- if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
+ if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
print("- could not detect gcc.")
print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
return False
@@ -130,57 +130,57 @@ def can_build():
return True
- if (os.name=="posix"):
+ if (os.name == "posix"):
mingw = "i586-mingw32msvc-"
mingw64 = "x86_64-w64-mingw32-"
mingw32 = "i686-w64-mingw32-"
if (os.getenv("MINGW32_PREFIX")):
- mingw32=os.getenv("MINGW32_PREFIX")
+ mingw32 = os.getenv("MINGW32_PREFIX")
mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
- mingw64=os.getenv("MINGW64_PREFIX")
+ mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version &>/dev/null"
- if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
+ if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
return True
return False
def get_opts():
- mingw=""
- mingw32=""
- mingw64=""
- if ( os.name == "posix" ):
+ mingw = ""
+ mingw32 = ""
+ mingw64 = ""
+ if (os.name == "posix"):
mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
+ if os.system(mingw32 + "gcc --version &>/dev/null") != 0:
mingw32 = mingw
if (os.getenv("MINGW32_PREFIX")):
- mingw32=os.getenv("MINGW32_PREFIX")
+ mingw32 = os.getenv("MINGW32_PREFIX")
mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
- mingw64=os.getenv("MINGW64_PREFIX")
+ mingw64 = os.getenv("MINGW64_PREFIX")
return [
- ('mingw_prefix','Mingw Prefix',mingw32),
- ('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
+ ('mingw_prefix', 'Mingw Prefix', mingw32),
+ ('mingw_prefix_64', 'Mingw Prefix 64 bits', mingw64),
]
def get_flags():
return [
('builtin_zlib', 'yes'),
- ('openssl','builtin'), #use builtin openssl
+ ('openssl', 'builtin'), # use builtin openssl
]
-def build_res_file( target, source, env ):
+def build_res_file(target, source, env):
cmdbase = ""
if (env["bits"] == "32"):
@@ -193,7 +193,7 @@ def build_res_file( target, source, env ):
for x in range(len(source)):
cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
try:
- out = subprocess.Popen(cmd,shell = True,stderr = subprocess.PIPE).communicate()
+ out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]):
return 1
except:
@@ -203,66 +203,66 @@ def build_res_file( target, source, env ):
def configure(env):
env.Append(CPPPATH=['#platform/windows'])
- env['is_mingw']=False
- if (os.name=="nt" and os.getenv("VCINSTALLDIR") ):
- #build using visual studio
+ env['is_mingw'] = False
+ if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
+ # build using visual studio
env['ENV']['TMP'] = os.environ['TMP']
env.Append(CPPPATH=['#platform/windows/include'])
env.Append(LIBPATH=['#platform/windows/lib'])
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
env.Append(CCFLAGS=['/O2'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- elif (env["target"]=="debug_release"):
+ elif (env["target"] == "debug_release"):
- env.Append(CCFLAGS=['/Z7','/Od'])
+ env.Append(CCFLAGS=['/Z7', '/Od'])
env.Append(LINKFLAGS=['/DEBUG'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['/Z7','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED','/DD3D_DEBUG_INFO','/Od'])
+ env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG'])
- env.Append(CCFLAGS=['/MT','/Gd','/GR','/nologo'])
+ env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
env.Append(CXXFLAGS=['/TP'])
env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
- env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
+ env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['/DWIN32'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
- LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid']
- env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
+ LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
+ env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
- env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
+ env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
if (os.getenv("DXSDK_DIR")):
- DIRECTX_PATH=os.getenv("DXSDK_DIR")
+ DIRECTX_PATH = os.getenv("DXSDK_DIR")
else:
- DIRECTX_PATH="C:/Program Files/Microsoft DirectX SDK (March 2009)"
+ DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"
if (os.getenv("VCINSTALLDIR")):
- VC_PATH=os.getenv("VCINSTALLDIR")
+ VC_PATH = os.getenv("VCINSTALLDIR")
else:
- VC_PATH=""
+ VC_PATH = ""
env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
- env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
- env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
+ env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
+ env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
env['ENV'] = os.environ;
# This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
@@ -272,26 +272,26 @@ def configure(env):
if(env["bits"] != "default"):
print "Error: bits argument is disabled for MSVC"
print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
- +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
- +" will be executed and inform you.")
+ + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
+ + " will be executed and inform you.")
sys.exit()
# Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
# that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
- env["bits"]="32"
- env["x86_libtheora_opt_vc"]=True
+ env["bits"] = "32"
+ env["x86_libtheora_opt_vc"] = True
- print "Detected MSVC compiler: "+compiler_version_str
+ print "Detected MSVC compiler: " + compiler_version_str
# If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
- env["bits"]="64"
- env["x86_libtheora_opt_vc"]=False
+ env["bits"] = "64"
+ env["x86_libtheora_opt_vc"] = False
print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
- elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
+ elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
else:
print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
- if env["bits"]=="64":
+ if env["bits"] == "64":
env.Append(CCFLAGS=['/D_WIN64'])
# Incremental linking fix
@@ -304,32 +304,32 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32
env.use_windows_spawn_fix()
- #build using mingw
- if (os.name=="nt"):
- env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
+ # build using mingw
+ if (os.name == "nt"):
+ env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
else:
- env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe" # for linux cross-compilation
+ env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
- mingw_prefix=""
+ mingw_prefix = ""
- if (env["bits"]=="default"):
- env["bits"]="32"
+ if (env["bits"] == "default"):
+ env["bits"] = "32"
- if (env["bits"]=="32"):
+ if (env["bits"] == "32"):
env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix=env["mingw_prefix"];
+ mingw_prefix = env["mingw_prefix"];
else:
env.Append(LINKFLAGS=['-static'])
- mingw_prefix=env["mingw_prefix_64"];
+ mingw_prefix = env["mingw_prefix_64"];
- nulstr=""
+ nulstr = ""
- if (os.name=="posix"):
- nulstr=">/dev/null"
+ if (os.name == "posix"):
+ nulstr = ">/dev/null"
else:
- nulstr=">nul"
+ nulstr = ">nul"
@@ -338,42 +338,42 @@ def configure(env):
# print("Can't find Windows compiler: "+mingw_prefix)
# sys.exit(255)
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
env.Append(CCFLAGS=['-msse2'])
- if (env["bits"]=="64"):
+ if (env["bits"] == "64"):
env.Append(CCFLAGS=['-O3'])
else:
env.Append(CCFLAGS=['-O2'])
env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ 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++"
- env['AR'] = mingw_prefix+"ar"
- env['RANLIB'] = mingw_prefix+"ranlib"
- env['LD'] = mingw_prefix+"g++"
- env["x86_libtheora_opt_gcc"]=True
+ env["CC"] = mingw_prefix + "gcc"
+ env['AS'] = mingw_prefix + "as"
+ env['CXX'] = mingw_prefix + "g++"
+ env['AR'] = mingw_prefix + "ar"
+ env['RANLIB'] = mingw_prefix + "ranlib"
+ env['LD'] = mingw_prefix + "g++"
+ env["x86_libtheora_opt_gcc"] = True
#env['CC'] = "winegcc"
#env['CXX'] = "wineg++"
- env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
+ env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DGLES2_ENABLED'])
- env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
# if (env["bits"]=="32"):
# env.Append(LIBS=['gcc_s'])
@@ -386,13 +386,13 @@ def configure(env):
#'d3dx9d'
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
- #env.Append(LINKFLAGS=['-g'])
+ # env.Append(LINKFLAGS=['-g'])
# resrc
- env['is_mingw']=True
- env.Append( BUILDERS = { 'RES' : env.Builder(action = build_res_file, suffix = '.o',src_suffix = '.rc') } )
+ env['is_mingw'] = True
+ env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
- 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') } )
- env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index 06bae980e..19a6324e1 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -12,8 +12,8 @@ def get_name():
return "WinRT"
def can_build():
- if (os.name=="nt"):
- #building natively on windows!
+ if (os.name == "nt"):
+ # building natively on windows!
if (os.getenv("VSINSTALLDIR")):
if (os.getenv("ANGLE_SRC_PATH") == None):
@@ -40,8 +40,8 @@ def configure(env):
if(env["bits"] != "default"):
print "Error: bits argument is disabled for MSVC"
print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
- +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
- +" will be executed and inform you.")
+ + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
+ + " will be executed and inform you.")
sys.exit()
arch = ""
@@ -60,8 +60,8 @@ def configure(env):
print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
- arch="arm"
- env["bits"]="32"
+ arch = "arm"
+ env["bits"] = "32"
env.Append(LINKFLAGS=['/MACHINE:ARM'])
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
@@ -74,14 +74,14 @@ def configure(env):
compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
- env["bits"]="64"
+ env["bits"] = "64"
print "Compiled program architecture will be a x64 executable (forcing bits=64)."
- elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
- env["bits"]="32"
+ elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+ env["bits"] = "32"
print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
else:
print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
- env["bits"]="32"
+ env["bits"] = "32"
if (env["bits"] == "32"):
arch = "x86"
@@ -102,29 +102,29 @@ def configure(env):
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
- env.Append(CPPPATH=['#platform/winrt','#drivers/windows'])
+ env.Append(CPPPATH=['#platform/winrt', '#drivers/windows'])
env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
- env.Append(CPPFLAGS=['/D','__WRL_NO_DEFAULT_LIB__','/D','WIN32'])
+ env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
env.Append(CPPFLAGS=['/O2', '/GL'])
env.Append(CPPFLAGS=['/MD'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2','/Zi','/DDEBUG_ENABLED'])
+ env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['/MD'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
env.Append(CPPFLAGS=['/MDd'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG'])
@@ -132,18 +132,18 @@ def configure(env):
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.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"]
+ env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
+ env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
+ env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]
env.Append(CCFLAGS=['/DWINRT_ENABLED'])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
- env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED'])
+ env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
LIBS = [
'WindowsApp',
@@ -152,15 +152,15 @@ def configure(env):
'libEGL',
'libGLESv2',
]
- env.Append(LINKFLAGS=[p+".lib" for p in LIBS])
+ env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])
# Incremental linking fix
env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
env['BUILDERS']['Program'] = methods.precious_program
- env.Append( BUILDERS = { 'ANGLE' : env.Builder(action = angle_build_cmd) } )
+ env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
- 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') } )
- env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/x11/SCsub b/platform/x11/SCsub
index 93cd2ca26..0defd4f02 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -3,11 +3,11 @@
Import('env')
-common_x11=[\
+common_x11 = [\
"context_gl_x11.cpp",\
"os_x11.cpp",\
"key_mapping_x11.cpp",\
"joystick_linux.cpp",\
]
-env.Program('#bin/godot',['godot_x11.cpp']+common_x11)
+env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 593e3fbb9..37c787179 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -13,56 +13,56 @@ def get_name():
def can_build():
- if (os.name!="posix"):
+ if (os.name != "posix"):
return False
if sys.platform == "darwin":
- return False # no x11 on mac for now
+ return False # no x11 on mac for now
- errorval=os.system("pkg-config --version > /dev/null")
+ errorval = os.system("pkg-config --version > /dev/null")
if (errorval):
print("pkg-config not found.. x11 disabled.")
return False
- x11_error=os.system("pkg-config x11 --modversion > /dev/null ")
+ x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
if (x11_error):
print("X11 not found.. x11 disabled.")
return False
- ssl_error=os.system("pkg-config openssl --modversion > /dev/null ")
+ ssl_error = os.system("pkg-config openssl --modversion > /dev/null ")
if (ssl_error):
print("OpenSSL not found.. x11 disabled.")
return False
- x11_error=os.system("pkg-config xcursor --modversion > /dev/null ")
+ x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
if (x11_error):
print("xcursor not found.. x11 disabled.")
return False
- x11_error=os.system("pkg-config xinerama --modversion > /dev/null ")
+ x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
if (x11_error):
print("xinerama not found.. x11 disabled.")
return False
- x11_error=os.system("pkg-config xrandr --modversion > /dev/null ")
+ x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
if (x11_error):
print("xrandr not found.. x11 disabled.")
return False
- return True # X11 enabled
+ return True # X11 enabled
def get_opts():
return [
- ('use_llvm','Use llvm compiler','no'),
- ('use_static_cpp','link stdc++ statically','no'),
- ('use_sanitizer','Use llvm compiler sanitize address','no'),
- ('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'),
- ('pulseaudio','Detect & Use pulseaudio','yes'),
- ('udev','Use udev for gamepad connection callbacks','no'),
- ('debug_release', 'Add debug symbols to release version','no'),
+ ('use_llvm', 'Use llvm compiler', 'no'),
+ ('use_static_cpp', 'link stdc++ statically', 'no'),
+ ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
+ ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
+ ('pulseaudio', 'Detect & Use pulseaudio', 'yes'),
+ ('udev', 'Use udev for gamepad connection callbacks', 'no'),
+ ('debug_release', 'Add debug symbols to release version', 'no'),
]
def get_flags():
@@ -77,56 +77,56 @@ def get_flags():
def configure(env):
- is64=sys.maxsize > 2**32
+ is64 = sys.maxsize > 2**32
- if (env["bits"]=="default"):
+ if (env["bits"] == "default"):
if (is64):
- env["bits"]="64"
+ env["bits"] = "64"
else:
- env["bits"]="32"
+ env["bits"] = "32"
env.Append(CPPPATH=['#platform/x11'])
- if (env["use_llvm"]=="yes"):
+ if (env["use_llvm"] == "yes"):
if 'clang++' not in env['CXX']:
- env["CC"]="clang"
- env["CXX"]="clang++"
- env["LD"]="clang++"
+ env["CC"] = "clang"
+ env["CXX"] = "clang++"
+ env["LD"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env.extra_suffix=".llvm"
+ env.extra_suffix = ".llvm"
- if (env["use_sanitizer"]=="yes"):
- env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
+ if (env["use_sanitizer"] == "yes"):
+ env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
- env.extra_suffix+="s"
+ env.extra_suffix += "s"
- if (env["use_leak_sanitizer"]=="yes"):
- env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
+ if (env["use_leak_sanitizer"] == "yes"):
+ env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
- env.extra_suffix+="s"
+ env.extra_suffix += "s"
- #if (env["tools"]=="no"):
+ # if (env["tools"]=="no"):
# #no tools suffix
# env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
# env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
- if (env["target"]=="release"):
+ if (env["target"] == "release"):
- if (env["debug_release"]=="yes"):
+ if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2'])
else:
- env.Append(CCFLAGS=['-O3','-ffast-math'])
+ env.Append(CCFLAGS=['-O3', '-ffast-math'])
- elif (env["target"]=="release_debug"):
+ elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- if (env["debug_release"]=="yes"):
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2'])
- elif (env["target"]=="debug"):
+ elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs')
@@ -180,7 +180,7 @@ def configure(env):
if (env["glew"] == "system"):
env.ParseConfig('pkg-config glew --cflags --libs')
- if os.system("pkg-config --exists alsa")==0:
+ if os.system("pkg-config --exists alsa") == 0:
print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
env.ParseConfig('pkg-config alsa --cflags --libs')
@@ -189,7 +189,7 @@ def configure(env):
if (platform.system() == "Linux"):
env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
- if (env["udev"]=="yes"):
+ if (env["udev"] == "yes"):
# pkg-config returns 0 when the lib exists...
found_udev = not os.system("pkg-config --exists libudev")
@@ -200,7 +200,7 @@ def configure(env):
else:
print("libudev development libraries not found, disabling udev support")
- if (env["pulseaudio"]=="yes"):
+ if (env["pulseaudio"] == "yes"):
if not os.system("pkg-config --exists libpulse-simple"):
print("Enabling PulseAudio")
env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
@@ -208,33 +208,33 @@ def configure(env):
else:
print("PulseAudio development libraries not found, disabling driver")
- env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
+ env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
env.Append(LIBS=['GL', 'pthread', 'z'])
if (platform.system() == "Linux"):
env.Append(LIBS='dl')
- #env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
+ # env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
-#host compiler is default..
+# host compiler is default..
- if (is64 and env["bits"]=="32"):
+ if (is64 and env["bits"] == "32"):
env.Append(CPPFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
- elif (not is64 and env["bits"]=="64"):
+ env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu'])
+ elif (not is64 and env["bits"] == "64"):
env.Append(CPPFLAGS=['-m64'])
- env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
+ 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') } )
- env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ 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')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- if (env["use_static_cpp"]=="yes"):
+ if (env["use_static_cpp"] == "yes"):
env.Append(LINKFLAGS=['-static-libstdc++'])
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
+ env["x86_libtheora_opt_gcc"] = True
diff --git a/scene/2d/SCsub b/scene/2d/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/2d/SCsub
+++ b/scene/2d/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 47825ea6c..90e78ba8d 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -3,11 +3,11 @@
Import('env')
-if (env["disable_3d"]=="yes"):
+if (env["disable_3d"] == "yes"):
env.scene_sources.append("3d/spatial.cpp")
env.scene_sources.append("3d/skeleton.cpp")
else:
- env.add_source_files(env.scene_sources,"*.cpp")
+ env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/SCsub b/scene/SCsub
index 79da36519..4a89eef46 100644
--- a/scene/SCsub
+++ b/scene/SCsub
@@ -2,8 +2,8 @@
Import('env')
-env.scene_sources=[]
-env.add_source_files(env.scene_sources,"*.cpp")
+env.scene_sources = []
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
@@ -17,6 +17,6 @@ SConscript('resources/SCsub');
SConscript('io/SCsub');
-lib = env.Library("scene",env.scene_sources)
+lib = env.Library("scene", env.scene_sources)
env.Prepend(LIBS=[lib])
diff --git a/scene/animation/SCsub b/scene/animation/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/animation/SCsub
+++ b/scene/animation/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/audio/SCsub b/scene/audio/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/audio/SCsub
+++ b/scene/audio/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/gui/SCsub b/scene/gui/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/gui/SCsub
+++ b/scene/gui/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/io/SCsub b/scene/io/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/io/SCsub
+++ b/scene/io/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/main/SCsub b/scene/main/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/main/SCsub
+++ b/scene/main/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/resources/SCsub b/scene/resources/SCsub
index 702ed1a9b..9c1e72f04 100644
--- a/scene/resources/SCsub
+++ b/scene/resources/SCsub
@@ -2,8 +2,8 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
-env.add_source_files(env.scene_sources,"*.c")
+env.add_source_files(env.scene_sources, "*.cpp")
+env.add_source_files(env.scene_sources, "*.c")
Export('env')
diff --git a/scene/resources/default_theme/SCsub b/scene/resources/default_theme/SCsub
index 9fa89edbf..bf9125be7 100644
--- a/scene/resources/default_theme/SCsub
+++ b/scene/resources/default_theme/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py
index ce0535709..d8799fd7d 100644
--- a/scene/resources/default_theme/make_header.py
+++ b/scene/resources/default_theme/make_header.py
@@ -4,15 +4,15 @@ import glob;
import string;
-#Generate include files
+# Generate include files
-f=open("theme_data.h","wb")
+f = open("theme_data.h", "wb")
f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
f.write("\n\n");
-#Generate png image block
+# Generate png image block
pixmaps = glob.glob("*.png");
@@ -22,23 +22,23 @@ f.write("\n\n\n");
for x in pixmaps:
- var_str=x[:-4]+"_png";
+ var_str = x[:-4] + "_png";
- f.write("static const unsigned char "+ var_str +"[]={\n");
+ f.write("static const unsigned char " + var_str + "[]={\n");
- pngf=open(x,"rb");
+ pngf = open(x, "rb");
- b=pngf.read(1);
- while(len(b)==1):
+ b = pngf.read(1);
+ while(len(b) == 1):
f.write(hex(ord(b)))
- b=pngf.read(1);
- if (len(b)==1):
+ b = pngf.read(1);
+ if (len(b) == 1):
f.write(",")
f.write("\n};\n\n\n");
pngf.close();
-#Generate shaders block
+# Generate shaders block
shaders = glob.glob("*.gsl")
@@ -48,22 +48,22 @@ f.write("\n\n\n");
for x in shaders:
- var_str=x[:-4]+"_shader_code";
+ var_str = x[:-4] + "_shader_code";
- f.write("static const char *"+ var_str +"=\n");
+ f.write("static const char *" + var_str + "=\n");
- sf=open(x,"rb");
+ sf = open(x, "rb");
- b=sf.readline();
- while(b!=""):
+ b = sf.readline();
+ while(b != ""):
if (b.endswith("\r\n")):
- b=b[:-2]
+ b = b[:-2]
if (b.endswith("\n")):
- b=b[:-1]
- f.write(" \""+b)
- b=sf.readline();
- if (b!=""):
+ b = b[:-1]
+ f.write(" \"" + b)
+ b = sf.readline();
+ if (b != ""):
f.write("\"\n")
f.write("\";\n\n\n");
diff --git a/servers/SCsub b/servers/SCsub
index 57b5b3675..8fab6c1dc 100644
--- a/servers/SCsub
+++ b/servers/SCsub
@@ -2,8 +2,8 @@
Import('env')
-env.servers_sources=[]
-env.add_source_files(env.servers_sources,"*.cpp")
+env.servers_sources = []
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
@@ -14,6 +14,6 @@ SConscript('audio/SCsub');
SConscript('spatial_sound/SCsub');
SConscript('spatial_sound_2d/SCsub');
-lib = env.Library("servers",env.servers_sources)
+lib = env.Library("servers", env.servers_sources)
env.Prepend(LIBS=[lib])
diff --git a/servers/audio/SCsub b/servers/audio/SCsub
index 4684bd6cf..ccc76e823 100644
--- a/servers/audio/SCsub
+++ b/servers/audio/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/servers/physics/SCsub b/servers/physics/SCsub
index b527f38ce..c0ee2cc73 100644
--- a/servers/physics/SCsub
+++ b/servers/physics/SCsub
@@ -2,7 +2,7 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/servers/physics/joints/SCsub b/servers/physics/joints/SCsub
index 4684bd6cf..ccc76e823 100644
--- a/servers/physics/joints/SCsub
+++ b/servers/physics/joints/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/servers/physics_2d/SCsub b/servers/physics_2d/SCsub
index 2114782fa..d73014486 100644
--- a/servers/physics_2d/SCsub
+++ b/servers/physics_2d/SCsub
@@ -2,4 +2,4 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/spatial_sound/SCsub b/servers/spatial_sound/SCsub
index 4684bd6cf..ccc76e823 100644
--- a/servers/spatial_sound/SCsub
+++ b/servers/spatial_sound/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/servers/spatial_sound_2d/SCsub b/servers/spatial_sound_2d/SCsub
index 4684bd6cf..ccc76e823 100644
--- a/servers/spatial_sound_2d/SCsub
+++ b/servers/spatial_sound_2d/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/servers/visual/SCsub b/servers/visual/SCsub
index 4684bd6cf..ccc76e823 100644
--- a/servers/visual/SCsub
+++ b/servers/visual/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
diff --git a/tools/SCsub b/tools/SCsub
index a54b8f48a..87ed836ae 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -2,18 +2,18 @@
Import('env')
-env.tool_sources=[]
-env.add_source_files(env.tool_sources,"*.cpp")
+env.tool_sources = []
+env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
-def make_translations_header(target,source,env):
+def make_translations_header(target, source, env):
dst = target[0].srcnode().abspath
- g = open(dst,"wb")
+ g = open(dst, "wb")
""""
@@ -29,24 +29,24 @@ def make_translations_header(target,source,env):
paths = [node.srcnode().abspath for node in source]
sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
- xl_names=[]
+ xl_names = []
for i in range(len(sorted_paths)):
- print("Appending translation: "+sorted_paths[i])
- f = open(sorted_paths[i],"rb")
+ print("Appending translation: " + sorted_paths[i])
+ f = open(sorted_paths[i], "rb")
buf = f.read()
decomp_size = len(buf)
buf = zlib.compress(buf)
- name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
+ name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")
- g.write("static const unsigned char _translation_"+name+"_compressed[]={\n")
+ g.write("static const unsigned char _translation_" + name + "_compressed[]={\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i]))+",\n")
+ g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
- xl_names.append([name,len(buf),str(decomp_size)])
+ xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n")
g.write("\tconst char* lang;\n");
@@ -56,19 +56,19 @@ def make_translations_header(target,source,env):
g.write("};\n\n");
g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names:
- g.write("\t{ \""+x[0]+"\", "+str(x[1])+", "+str(x[2])+",_translation_"+x[0]+"_compressed},\n")
+ g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
g.write("\t{NULL,0,0,NULL}\n")
g.write("};\n")
g.write("#endif")
-def make_fonts_header(target,source,env):
+def make_fonts_header(target, source, env):
dst = target[0].srcnode().abspath
- g = open(dst,"wb")
+ g = open(dst, "wb")
""""
@@ -78,48 +78,48 @@ def make_fonts_header(target,source,env):
g.write("#ifndef _EDITOR_FONTS_H\n")
g.write("#define _EDITOR_FONTS_H\n")
- #saving uncompressed, since freetype will reference from memory pointer
- xl_names=[]
+ # saving uncompressed, since freetype will reference from memory pointer
+ xl_names = []
for i in range(len(source)):
- print("Appending font: "+source[i].srcnode().abspath)
- f = open(source[i].srcnode().abspath,"rb")
+ print("Appending font: " + source[i].srcnode().abspath)
+ f = open(source[i].srcnode().abspath, "rb")
buf = f.read()
import os.path
- name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
+ name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
- g.write("static const int _font_"+name+"_size="+str(len(buf))+";\n")
- g.write("static const unsigned char _font_"+name+"[]={\n")
+ g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n")
+ g.write("static const unsigned char _font_" + name + "[]={\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i]))+",\n")
+ g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
-if (env["tools"]!="no"):
+if (env["tools"] != "no"):
import glob
dir = env.Dir('.').abspath
tlist = glob.glob(dir + "/translations/*.po")
- print("translations: ",tlist)
- env.Depends('#tools/editor/translations.h',tlist)
- env.Command('#tools/editor/translations.h',tlist,make_translations_header)
+ print("translations: ", tlist)
+ env.Depends('#tools/editor/translations.h', tlist)
+ env.Command('#tools/editor/translations.h', tlist, make_translations_header)
flist = glob.glob(dir + "/editor_fonts/*.ttf")
- flist.append( glob.glob(dir + "/editor_fonts/*.otf") )
+ flist.append(glob.glob(dir + "/editor_fonts/*.otf"))
- print("fonts: ",flist)
- env.Depends('#tools/editor/builtin_fonts.h',flist)
- env.Command('#tools/editor/builtin_fonts.h',flist,make_fonts_header)
+ print("fonts: ", flist)
+ env.Depends('#tools/editor/builtin_fonts.h', flist)
+ env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
SConscript('editor/SCsub');
SConscript('collada/SCsub');
SConscript('doc/SCsub')
- lib = env.Library("tool",env.tool_sources)
+ lib = env.Library("tool", env.tool_sources)
env.Prepend(LIBS=[lib])
diff --git a/tools/collada/SCsub b/tools/collada/SCsub
index 473474201..4bc64ffdc 100644
--- a/tools/collada/SCsub
+++ b/tools/collada/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.tool_sources,"*.cpp")
+env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
diff --git a/tools/doc/SCsub b/tools/doc/SCsub
index 473474201..4bc64ffdc 100644
--- a/tools/doc/SCsub
+++ b/tools/doc/SCsub
@@ -2,6 +2,6 @@
Import('env')
-env.add_source_files(env.tool_sources,"*.cpp")
+env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
diff --git a/tools/editor/SCsub b/tools/editor/SCsub
index 41b4386e2..0dbb7d3f2 100644
--- a/tools/editor/SCsub
+++ b/tools/editor/SCsub
@@ -3,12 +3,12 @@
Import('env')
-def make_doc_header(target,source,env):
+def make_doc_header(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
- f = open(src,"rb")
- g = open(dst,"wb")
+ f = open(src, "rb")
+ g = open(dst, "wb")
buf = f.read()
decomp_size = len(buf)
import zlib
@@ -18,22 +18,22 @@ def make_doc_header(target,source,env):
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")
- g.write("static const int _doc_data_compressed_size="+str(len(buf))+";\n")
- g.write("static const int _doc_data_uncompressed_size="+str(decomp_size)+";\n")
+ g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n")
+ g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[]={\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i]))+",\n")
+ g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
-def make_certs_header(target,source,env):
+def make_certs_header(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
- f = open(src,"rb")
- g = open(dst,"wb")
+ f = open(src, "rb")
+ g = open(dst, "wb")
buf = f.read()
decomp_size = len(buf)
import zlib
@@ -43,11 +43,11 @@ def make_certs_header(target,source,env):
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _CERTS_RAW_H\n")
g.write("#define _CERTS_RAW_H\n")
- g.write("static const int _certs_compressed_size="+str(len(buf))+";\n")
- g.write("static const int _certs_uncompressed_size="+str(decomp_size)+";\n")
+ g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n")
+ g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[]={\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i]))+",\n")
+ g.write(str(ord(buf[i])) + ",\n")
g.write("};\n")
g.write("#endif")
@@ -57,29 +57,29 @@ def make_certs_header(target,source,env):
-if (env["tools"]=="yes"):
+if (env["tools"] == "yes"):
- reg_exporters_inc='#include "register_exporters.h"\n'
- reg_exporters='void register_exporters() {\n'
+ reg_exporters_inc = '#include "register_exporters.h"\n'
+ reg_exporters = 'void register_exporters() {\n'
for e in env.platform_exporters:
- env.tool_sources.append("#platform/"+e+"/export/export.cpp")
- reg_exporters+='\tregister_'+e+'_exporter();\n'
- reg_exporters_inc+='#include "platform/'+e+'/export/export.h"\n'
- reg_exporters+='}\n'
- f = open("register_exporters.cpp","wb")
+ env.tool_sources.append("#platform/" + e + "/export/export.cpp")
+ reg_exporters += '\tregister_' + e + '_exporter();\n'
+ reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
+ reg_exporters += '}\n'
+ f = open("register_exporters.cpp", "wb")
f.write(reg_exporters_inc)
f.write(reg_exporters)
f.close()
- env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml")
- env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header)
+ env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml")
+ env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header)
- env.Depends("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt")
- env.Command("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt",make_certs_header)
+ env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt")
+ env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header)
- #make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)
+ # make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)
- env.add_source_files(env.tool_sources,"*.cpp")
+ env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
SConscript('icons/SCsub');
diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub
index 6299fd416..4bf55189c 100644
--- a/tools/editor/fileserver/SCsub
+++ b/tools/editor/fileserver/SCsub
@@ -2,4 +2,4 @@
Import('env')
Export('env')
-env.add_source_files(env.tool_sources,"*.cpp")
+env.add_source_files(env.tool_sources, "*.cpp")
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index 4806a89df..ac942b20e 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -16,47 +16,47 @@ def make_editor_icons_action(target, source, env):
s.write("#include \"editor_scale.h\"\n\n")
s.write("#include \"scene/resources/theme.h\"\n\n")
- hidpi_list=[]
+ hidpi_list = []
for x in pixmaps:
- x=str(x)
- var_str=os.path.basename(x)[:-4]+"_png";
- #print(var_str)
+ x = str(x)
+ var_str = os.path.basename(x)[:-4] + "_png";
+ # print(var_str)
- s.write("static const unsigned char "+ var_str +"[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n");
- pngf=open(x,"rb");
+ pngf = open(x, "rb");
- b=pngf.read(1);
- while(len(b)==1):
+ b = pngf.read(1);
+ while(len(b) == 1):
s.write(hex(ord(b)))
- b=pngf.read(1);
- if (len(b)==1):
+ b = pngf.read(1);
+ if (len(b) == 1):
s.write(",")
s.write("\n};\n\n");
pngf.close();
- var_str=os.path.basename(x)[:-4]+"_hidpi_png";
+ var_str = os.path.basename(x)[:-4] + "_hidpi_png";
try:
- pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb")
+ pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb")
- s.write("static const unsigned char "+ var_str +"[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n");
- b=pngf.read(1);
- while(len(b)==1):
+ b = pngf.read(1);
+ while(len(b) == 1):
s.write(hex(ord(b)))
- b=pngf.read(1);
- if (len(b)==1):
+ b = pngf.read(1);
+ if (len(b) == 1):
s.write(",")
s.write("\n};\n\n\n");
hidpi_list.append(x)
except:
- s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n");
+ s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n");
@@ -75,24 +75,24 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps:
- x=os.path.basename(str(x))
- type=x[5:-4].title().replace("_","");
- var_str=x[:-4]+"_png";
- var_str_hidpi=x[:-4]+"_hidpi_png";
- s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+","+var_str_hidpi+"));\n");
+ x = os.path.basename(str(x))
+ type = x[5:-4].title().replace("_", "");
+ var_str = x[:-4] + "_png";
+ var_str_hidpi = x[:-4] + "_hidpi_png";
+ s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n");
s.write("\n\n}\n\n");
- f = open(dst,"wb")
+ f = open(dst, "wb")
f.write(s.getvalue())
f.close()
s.close()
make_editor_icons_builder = Builder(action=make_editor_icons_action,
- suffix = '.cpp',
- src_suffix = '.png')
-env['BUILDERS']['MakeEditorIconsBuilder']=make_editor_icons_builder
-env.Alias('editor_icons',[env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp',Glob("*.png"))])
+ suffix='.cpp',
+ src_suffix='.png')
+env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder
+env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp', Glob("*.png"))])
env.tool_sources.append("#tools/editor/editor_icons.cpp")
Export('env')
diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub
index 6299fd416..4bf55189c 100644
--- a/tools/editor/io_plugins/SCsub
+++ b/tools/editor/io_plugins/SCsub
@@ -2,4 +2,4 @@
Import('env')
Export('env')
-env.add_source_files(env.tool_sources,"*.cpp")
+env.add_source_files(env.tool_sources, "*.cpp")
diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub
index 6299fd416..4bf55189c 100644
--- a/tools/editor/plugins/SCsub
+++ b/tools/editor/plugins/SCsub
@@ -2,4 +2,4 @@
Import('env')
Export('env')
-env.add_source_files(env.tool_sources,"*.cpp")
+env.add_source_files(env.tool_sources, "*.cpp")
diff --git a/tools/scripts/addheader.py b/tools/scripts/addheader.py
index fac35372d..573d5182f 100644
--- a/tools/scripts/addheader.py
+++ b/tools/scripts/addheader.py
@@ -1,4 +1,4 @@
-header="""\
+header = """\
/*************************************************************************/
/* $filename */
/*************************************************************************/
@@ -29,44 +29,44 @@ header="""\
/*************************************************************************/
"""
-f = open("files","rb")
+f = open("files", "rb")
fname = f.readline()
-while (fname!=""):
+while (fname != ""):
- fr = open(fname.strip(),"rb")
+ fr = open(fname.strip(), "rb")
l = fr.readline()
- bc=False
+ bc = False
fsingle = fname.strip()
- if (fsingle.find("/")!=-1):
- fsingle=fsingle[fsingle.rfind("/")+1:]
- rep_fl="$filename"
- rep_fi=fsingle
- len_fl=len(rep_fl)
- len_fi=len(rep_fi)
- if (len_fi0):
- cstr+=", "
- cstr+=c
+ c = font_chars[i]
+ if (i > 0):
+ cstr += ", "
+ cstr += c
-cstr+=("};")
+cstr += ("};")
print(cstr)
diff --git a/tools/scripts/make_glwrapper.py b/tools/scripts/make_glwrapper.py
index 8da4e28c8..9f26f8430 100644
--- a/tools/scripts/make_glwrapper.py
+++ b/tools/scripts/make_glwrapper.py
@@ -1,31 +1,31 @@
#! /usr/bin/env python
import sys
-if (len(sys.argv)<2):
+if (len(sys.argv) < 2):
print("usage: make_glwrapper.py ")
sys.exit(255)
-functions=[]
-types=[]
-constants=[]
+functions = []
+types = []
+constants = []
-READ_FUNCTIONS=0
-READ_TYPES=1
-READ_CONSTANTS=2
+READ_FUNCTIONS = 0
+READ_TYPES = 1
+READ_CONSTANTS = 2
-read_what=READ_TYPES
+read_what = READ_TYPES
-for x in (range(len(sys.argv)-1)):
- f=open(sys.argv[x+1],"r")
+for x in (range(len(sys.argv) - 1)):
+ f = open(sys.argv[x + 1], "r")
while(True):
- line=f.readline()
- if (line==""):
+ line = f.readline()
+ if (line == ""):
break
- line=line.replace("\n","").strip()
+ line = line.replace("\n", "").strip()
"""
if (line.find("[types]")!=-1):
read_what=READ_TYPES
@@ -38,67 +38,67 @@ for x in (range(len(sys.argv)-1)):
continue
"""
- if (line.find("#define")!=-1):
- if (line.find("0x")==-1 and line.find("GL_VERSION")==-1):
+ if (line.find("#define") != -1):
+ if (line.find("0x") == -1 and line.find("GL_VERSION") == -1):
continue
constants.append(line)
- elif (line.find("typedef")!=-1):
- if (line.find("(")!=-1 or line.find(")")!=-1 or line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("GL")==-1):
+ elif (line.find("typedef") != -1):
+ if (line.find("(") != -1 or line.find(")") != -1 or line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("GL") == -1):
continue
types.append(line)
- elif (line.find("APIENTRY")!=-1 and line.find("GLAPI")!=-1):
+ elif (line.find("APIENTRY") != -1 and line.find("GLAPI") != -1):
- if (line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("NV")!=-1):
+ if (line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("NV") != -1):
continue
- line=line.replace("APIENTRY","")
- line=line.replace("GLAPI","")
+ line = line.replace("APIENTRY", "")
+ line = line.replace("GLAPI", "")
- glpos=line.find(" gl")
- if (glpos==-1):
+ glpos = line.find(" gl")
+ if (glpos == -1):
- glpos=line.find("\tgl")
- if (glpos==-1):
+ glpos = line.find("\tgl")
+ if (glpos == -1):
continue
- ret=line[:glpos].strip();
+ ret = line[:glpos].strip();
- line=line[glpos:].strip()
- namepos=line.find("(")
+ line = line[glpos:].strip()
+ namepos = line.find("(")
- if (namepos==-1):
+ if (namepos == -1):
continue
- name=line[:namepos].strip()
- line=line[namepos:]
+ name = line[:namepos].strip()
+ line = line[namepos:]
- argpos=line.rfind(")")
- if (argpos==-1):
+ argpos = line.rfind(")")
+ if (argpos == -1):
continue
- args=line[1:argpos]
+ args = line[1:argpos]
- funcdata={}
- funcdata["ret"]=ret
- funcdata["name"]=name
- funcdata["args"]=args
+ funcdata = {}
+ funcdata["ret"] = ret
+ funcdata["name"] = name
+ funcdata["args"] = args
functions.append(funcdata)
print(funcdata)
-#print(types)
-#print(constants)
-#print(functions)
+# print(types)
+# print(constants)
+# print(functions)
-f=open("glwrapper.h","w")
+f = open("glwrapper.h", "w")
f.write("#ifndef GL_WRAPPER\n")
f.write("#define GL_WRAPPER\n\n\n")
-header_code="""\
+header_code = """\
#if defined(__gl_h_) || defined(__GL_H__)
#error gl.h included before glwrapper.h
#endif
@@ -137,18 +137,18 @@ f.write("#else\n");
f.write("#define GLWRP_APIENTRY \n")
f.write("#endif\n\n");
for x in types:
- f.write(x+"\n")
+ f.write(x + "\n")
f.write("\n\n")
for x in constants:
- f.write(x+"\n")
+ f.write(x + "\n")
f.write("\n\n")
for x in functions:
- f.write("extern "+x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+");\n")
- f.write("#define "+x["name"]+" __wrapper_"+x["name"]+"\n")
+ f.write("extern " + x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ");\n")
+ f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n")
f.write("\n\n")
f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n");
@@ -158,21 +158,21 @@ f.write("#ifdef __cplusplus\n}\n#endif\n")
f.write("#endif\n\n")
-f=open("glwrapper.c","w")
+f = open("glwrapper.c", "w")
f.write("\n\n")
f.write("#include \"glwrapper.h\"\n")
f.write("\n\n")
for x in functions:
- f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n")
+ f.write(x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ")=NULL;\n")
f.write("\n\n")
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n")
f.write("\n")
for x in functions:
- f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n")
+ f.write("\t__wrapper_" + x["name"] + "=(" + x["ret"] + " GLWRP_APIENTRY (*)(" + x["args"] + "))wrapperFunc(\"" + x["name"] + "\");\n")
f.write("\n\n")
f.write("}\n")
diff --git a/tools/scripts/makeargs.py b/tools/scripts/makeargs.py
index 7db9da82a..a52812eaf 100644
--- a/tools/scripts/makeargs.py
+++ b/tools/scripts/makeargs.py
@@ -1,5 +1,5 @@
-text="""
+text = """
#define FUNC$numR(m_r,m_func,$argt)\\
virtual m_r m_func($argtp) { \\
if (Thread::get_caller_ID()!=server_thread) {\\
@@ -65,21 +65,21 @@ text="""
-for i in range(1,8):
+for i in range(1, 8):
- tp=""
- p=""
- t=""
+ tp = ""
+ p = ""
+ t = ""
for j in range(i):
- if (j>0):
- tp+=", "
- p+=", "
- t+=", "
- tp +=("m_arg"+str(j+1)+" p"+str(j+1))
- p+=("p"+str(j+1))
- t+=("m_arg"+str(j+1))
-
- t = text.replace("$argtp",tp).replace("$argp",p).replace("$argt",t).replace("$num",str(i))
+ if (j > 0):
+ tp += ", "
+ p += ", "
+ t += ", "
+ tp += ("m_arg" + str(j + 1) + " p" + str(j + 1))
+ p += ("p" + str(j + 1))
+ t += ("m_arg" + str(j + 1))
+
+ t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i))
print(t)
diff --git a/tools/scripts/memsort.py b/tools/scripts/memsort.py
index 15b4e7a84..fb636b0f7 100644
--- a/tools/scripts/memsort.py
+++ b/tools/scripts/memsort.py
@@ -1,35 +1,35 @@
import sys
-arg="memdump.txt"
+arg = "memdump.txt"
-if (len(sys.argv)>1):
- arg=sys.argv[1]
+if (len(sys.argv) > 1):
+ arg = sys.argv[1]
-f = open(arg,"rb")
+f = open(arg, "rb")
-l=f.readline()
+l = f.readline()
sum = {}
-cnt={}
+cnt = {}
-while(l!=""):
+while(l != ""):
- s=l.split("-")
+ s = l.split("-")
amount = int(s[1])
- what=s[2]
+ what = s[2]
if (what in sum):
- sum[what]+=amount
- cnt[what]+=1
+ sum[what] += amount
+ cnt[what] += 1
else:
- sum[what]=amount
- cnt[what]=1
+ sum[what] = amount
+ cnt[what] = 1
- l=f.readline()
+ l = f.readline()
for x in sum:
- print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x]))
+ print(x.strip() + "(" + str(cnt[x]) + "):\n: " + str(sum[x]))
diff --git a/tools/scripts/svgs_2_pngs.py b/tools/scripts/svgs_2_pngs.py
index 4de69a14b..b55fd97d0 100644
--- a/tools/scripts/svgs_2_pngs.py
+++ b/tools/scripts/svgs_2_pngs.py
@@ -51,7 +51,7 @@ def export_icons():
# name without extensions
name_only = file_name.replace('.svg', '')
- out_icon_names = [name_only] # export to a png with the same file name
+ out_icon_names = [name_only] # export to a png with the same file name
theme_out_icon_names = []
# special cases
if special_icons.has_key(name_only):
@@ -82,7 +82,7 @@ def export_theme():
# name without extensions
name_only = file_name.replace('.svg', '')
- out_icon_names = [name_only] # export to a png with the same file name
+ out_icon_names = [name_only] # export to a png with the same file name
# special cases
if theme_icons.has_key(name_only):
special_icon = theme_icons[name_only]
@@ -102,30 +102,30 @@ special_icons = {
output_names=['icon_add'],
theme_output_names=['icon_add', 'icon_zoom_more']
),
- 'icon_new': dict( output_names=['icon_file'] ),
- 'icon_animation_tree_player': dict( output_names=['icon_animation_tree'] ),
+ 'icon_new': dict(output_names=['icon_file']),
+ 'icon_animation_tree_player': dict(output_names=['icon_animation_tree']),
'icon_tool_rotate': dict(
output_names=['icon_reload'],
- theme_output_names= ['icon_reload']
+ theme_output_names=['icon_reload']
),
- 'icon_multi_edit': dict( output_names=['icon_multi_node_edit'] ),
+ 'icon_multi_edit': dict(output_names=['icon_multi_node_edit']),
'icon_folder': dict(
output_names=['icon_load', 'icon_open'],
- theme_output_names= ['icon_folder']
+ theme_output_names=['icon_folder']
),
- 'icon_file_list': dict( output_names=['icon_enum'] ),
- 'icon_collision_2d': dict( output_names=['icon_collision_polygon_2d', 'icon_polygon_2d'] ),
- 'icon_class_list': dict( output_names=['icon_filesystem'] ),
- 'icon_color_ramp': dict( output_names=['icon_graph_color_ramp'] ),
- 'icon_translation': dict( output_names=['icon_p_hash_translation'] ),
- 'icon_shader': dict( output_names=['icon_shader_material', 'icon_material_shader'] ),
- 'icon_canvas_item_shader_graph': dict( output_names=['icon_material_shader_graph'] ),
-
- 'icon_color_pick': dict( theme_output_names= ['icon_color_pick'], avoid_self=True ),
- 'icon_play': dict( theme_output_names= ['icon_play'] ),
- 'icon_stop': dict( theme_output_names= ['icon_stop'] ),
- 'icon_zoom_less': dict( theme_output_names= ['icon_zoom_less'], avoid_self=True ),
- 'icon_zoom_reset': dict( theme_output_names= ['icon_zoom_reset'], avoid_self=True ),
+ 'icon_file_list': dict(output_names=['icon_enum']),
+ 'icon_collision_2d': dict(output_names=['icon_collision_polygon_2d', 'icon_polygon_2d']),
+ 'icon_class_list': dict(output_names=['icon_filesystem']),
+ 'icon_color_ramp': dict(output_names=['icon_graph_color_ramp']),
+ 'icon_translation': dict(output_names=['icon_p_hash_translation']),
+ 'icon_shader': dict(output_names=['icon_shader_material', 'icon_material_shader']),
+ 'icon_canvas_item_shader_graph': dict(output_names=['icon_material_shader_graph']),
+
+ 'icon_color_pick': dict(theme_output_names=['icon_color_pick'], avoid_self=True),
+ 'icon_play': dict(theme_output_names=['icon_play']),
+ 'icon_stop': dict(theme_output_names=['icon_stop']),
+ 'icon_zoom_less': dict(theme_output_names=['icon_zoom_less'], avoid_self=True),
+ 'icon_zoom_reset': dict(theme_output_names=['icon_zoom_reset'], avoid_self=True),
'icon_snap': dict(theme_output_names=['icon_snap'])
}
diff --git a/tools/translations/extract.py b/tools/translations/extract.py
index f2ee1ecb1..bd6f03237 100755
--- a/tools/translations/extract.py
+++ b/tools/translations/extract.py
@@ -78,7 +78,7 @@ for fname in matches:
msg += l[pos]
pos += 1
- location = os.path.relpath(fname).replace('\\','/')
+ location = os.path.relpath(fname).replace('\\', '/')
if (line_nb):
location += ":" + str(lc)
@@ -115,7 +115,7 @@ shutil.move("tools.pot", "tools/translations/tools.pot")
# TODO: Make that in a portable way, if we care; if not, kudos to Unix users
if (os.name == "posix"):
- added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell = True)
- removed = subprocess.check_output("git diff tools/translations/tools.pot | grep \\\-msgid | wc -l", shell = True)
+ added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell=True)
+ removed = subprocess.check_output("git diff tools/translations/tools.pot | grep \\\-msgid | wc -l", shell=True)
print("\n# Template changes compared to the staged status:")
print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed)))
diff --git a/version.py b/version.py
index bf1d33c1c..d014a538c 100644
--- a/version.py
+++ b/version.py
@@ -1,5 +1,5 @@
-short_name="godot"
-name="Godot Engine"
-major=2
-minor=2
-status="alpha"
+short_name = "godot"
+name = "Godot Engine"
+major = 2
+minor = 2
+status = "alpha"
--
cgit v1.2.3-70-g09d2
From 817dd7ccbb166b27c93706dffc5c0c0d59fd87f8 Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Sun, 30 Oct 2016 19:05:14 +0100
Subject: 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(-)
(limited to 'doc/tools/doc_merge.py')
diff --git a/SConstruct b/SConstruct
index ee3a54b5a..a1c013422 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 5debf1345..ef71c4264 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 747a87037..d9f7cc9da 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 4e108f352..e05bcd63e 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 32a52a584..49a960c43 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 95a35960b..369f559f2 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 0693291f3..bd0d4c681 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 2f3b9c269..6b6780ce1 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 38dee11a3..269e07640 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 3de042511..fb920482f 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 ae0a3d75e..5698a3729 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 ae0a3d75e..5698a3729 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 ae0a3d75e..5698a3729 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 ae0a3d75e..5698a3729 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 667b5d8ba..5347cfd24 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 81e6163a9..cc8f09801 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 3de042511..fb920482f 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 ae0a3d75e..5698a3729 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 3de042511..fb920482f 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 3de042511..fb920482f 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 3de042511..fb920482f 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 f1331d24d..5de4f1144 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 ed320bebc..95720794b 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 23e5e2e71..d0c244a19 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 e64be0a18..71202a9a4 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 541487d58..229038697 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 56b41a49a..04a6bc9cc 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 ddb27742a..9191f1aab 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 9d23ceda7..b367e1f2c 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 4bb6dc4a9..93d29a360 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 19a6324e1..15ac42968 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 37c787179..935a9fcc2 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 d8799fd7d..41d5e2e25 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 87ed836ae..f11aa34ee 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 0dbb7d3f2..625103eae 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 ac942b20e..f27350a18 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 573d5182f..7838e16ae 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 8b7c3edd7..da95c9505 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 e6aa43f6b..1d3c40f9c 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 9f26f8430..bae0eeead 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 a52812eaf..2cd47ae08 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 b55fd97d0..b24324dcd 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))]
--
cgit v1.2.3-70-g09d2
From f34151ff0f91e8f0df8eaf829334b2205eb7da3c Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Tue, 1 Nov 2016 00:24:30 +0100
Subject: style: Various other PEP8 fixes in Python files
Done with `autopep8 --select=E7`, fixes:
- E701 - Put colon-separated compound statement on separate lines.
- E702 - Put semicolon-separated compound statement on separate lines.
- E703 - Put semicolon-separated compound statement on separate lines.
- E711 - Fix comparison with None.
- E712 - Fix (trivial case of) comparison with boolean.
- E713 - Fix (trivial case of) non-membership check.
- E721 - Fix various deprecated code (via lib2to3).
---
SConstruct | 22 +-
bin/SCsub | 2 +-
core/SCsub | 8 +-
doc/tools/doc_merge.py | 30 +-
doc/tools/makedoku.py | 2 +-
doc/tools/makehtml.py | 28 +-
drivers/SCsub | 22 +-
drivers/gles2/shaders/SCsub | 10 +-
drivers/png/SCsub | 2 +-
methods.py | 446 +++++++++++++--------------
modules/openssl/SCsub | 2 +-
platform/android/detect.py | 4 +-
platform/iphone/SCsub | 2 +-
platform/javascript/detect.py | 2 +-
platform/windows/detect.py | 6 +-
platform/winrt/detect.py | 2 +-
scene/SCsub | 16 +-
scene/resources/SCsub | 2 +-
scene/resources/default_theme/make_header.py | 50 +--
servers/SCsub | 12 +-
tools/SCsub | 14 +-
tools/editor/SCsub | 8 +-
tools/editor/icons/SCsub | 36 +--
tools/scripts/file-hex-array.py | 3 +-
tools/scripts/make_glwrapper.py | 10 +-
25 files changed, 371 insertions(+), 370 deletions(-)
(limited to 'doc/tools/doc_merge.py')
diff --git a/SConstruct b/SConstruct
index a1c013422..0d8a84b6e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-EnsureSConsVersion(0, 14);
+EnsureSConsVersion(0, 14)
import string
@@ -37,7 +37,7 @@ for x in glob.glob("platform/*"):
global_defaults.append(x[9:])
if (detect.is_active()):
active_platforms.append(detect.get_name())
- active_platform_ids.append(x);
+ active_platform_ids.append(x)
if (detect.can_build()):
x = x.replace("platform/", "") # rest of world
x = x.replace("platform\\", "") # win32
@@ -64,7 +64,7 @@ elif (os.name == "nt"):
if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android"):
custom_tools = ['mingw']
-env_base = Environment(tools=custom_tools);
+env_base = Environment(tools=custom_tools)
if 'TERM' in os.environ:
env_base['ENV']['TERM'] = os.environ['TERM']
env_base.AppendENVPath('PATH', os.getenv('PATH'))
@@ -140,9 +140,9 @@ opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin')
opts.Add('xaudio2', 'XAudio2 audio driver (yes/no)', 'no')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
-opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler");
-opts.Add("CFLAGS", "Custom flags for the C compiler");
-opts.Add("LINKFLAGS", "Custom flags for the linker");
+opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler")
+opts.Add("CFLAGS", "Custom flags for the C compiler")
+opts.Add("LINKFLAGS", "Custom flags for the linker")
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.', '')
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
@@ -180,11 +180,11 @@ sys.modules.pop('detect')
"""
if (env_base['target'] == 'debug'):
- env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
+ env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated'] != 'no'):
- env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']);
+ env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED'])
env_base.platforms = {}
@@ -264,7 +264,7 @@ if selected_platform in platform_list:
sys.exit(255)
suffix += ".opt"
- env.Append(CCFLAGS=['-DNDEBUG']);
+ env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"):
if (env["tools"] == "yes"):
@@ -312,7 +312,7 @@ if selected_platform in platform_list:
sys.modules.pop('config')
if (env.use_ptrcall):
- env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
+ env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
@@ -349,7 +349,7 @@ if selected_platform in platform_list:
SConscript("modules/SCsub")
SConscript("main/SCsub")
- SConscript("platform/" + selected_platform + "/SCsub"); # build selected platform
+ SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
diff --git a/bin/SCsub b/bin/SCsub
index 6b29a44fd..52f7e3bb3 100644
--- a/bin/SCsub
+++ b/bin/SCsub
@@ -3,4 +3,4 @@
Import('env')
Export('env')
-SConscript('tests/SCsub');
+SConscript('tests/SCsub')
diff --git a/core/SCsub b/core/SCsub
index 558df83d0..caae3a1c9 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -57,10 +57,10 @@ Export('env')
import make_binders
env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
-SConscript('os/SCsub');
-SConscript('math/SCsub');
-SConscript('io/SCsub');
-SConscript('bind/SCsub');
+SConscript('os/SCsub')
+SConscript('math/SCsub')
+SConscript('io/SCsub')
+SConscript('bind/SCsub')
lib = env.Library("core", env.core_sources)
diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py
index d9f7cc9da..57ac4bdcd 100644
--- a/doc/tools/doc_merge.py
+++ b/doc/tools/doc_merge.py
@@ -26,11 +26,11 @@ def write_string(_f, text, newline=True):
def escape(ret):
- ret = ret.replace("&", "&");
- ret = ret.replace("<", ">");
- ret = ret.replace(">", "<");
- ret = ret.replace("'", "'");
- ret = ret.replace("\"", """);
+ ret = ret.replace("&", "&")
+ ret = ret.replace("<", ">")
+ ret = ret.replace(">", "<")
+ ret = ret.replace("'", "'")
+ ret = ret.replace("\"", """)
return ret
@@ -138,22 +138,22 @@ def write_class(c):
for a in list(m):
if (a.tag == "return"):
typ = get_tag(a, "type")
- write_string(f, '');
- write_string(f, '');
+ write_string(f, '')
+ write_string(f, '')
elif (a.tag == "argument"):
default = get_tag(a, "default")
- write_string(f, '');
- write_string(f, '');
+ write_string(f, '')
+ write_string(f, '')
- write_string(f, '');
+ write_string(f, '')
if (old_class != None):
old_method_descr = find_method_descr(old_class, m.attrib["name"])
if (old_method_descr):
write_string(f, escape(escape(old_method_descr.strip())))
- write_string(f, '');
+ write_string(f, '')
dec_tab()
write_string(f, "")
dec_tab()
@@ -173,15 +173,15 @@ def write_class(c):
for a in list(m):
if (a.tag == "argument"):
- write_string(f, '');
- write_string(f, '');
+ write_string(f, '')
+ write_string(f, '')
- write_string(f, '');
+ write_string(f, '')
if (old_class != None):
old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
if (old_signal_descr):
write_string(f, escape(old_signal_descr.strip()))
- write_string(f, '');
+ write_string(f, '')
dec_tab()
write_string(f, "")
dec_tab()
diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py
index 49a960c43..ad3bfd791 100644
--- a/doc/tools/makedoku.py
+++ b/doc/tools/makedoku.py
@@ -17,7 +17,7 @@ if len(input_list) < 1:
def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
sys.exit(255)
diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py
index 369f559f2..3ecb8220c 100644
--- a/doc/tools/makehtml.py
+++ b/doc/tools/makehtml.py
@@ -40,7 +40,7 @@ if len(input_list) < 1:
def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
sys.exit(255)
@@ -90,7 +90,7 @@ def make_html_top(body, bottom=False):
def make_html_class_list(class_list, columns):
div = ET.Element("div")
- div.attrib["class"] = "ClassList";
+ div.attrib["class"] = "ClassList"
h1 = ET.SubElement(div, "h2")
h1.text = "Alphabetical Class List"
@@ -463,7 +463,7 @@ def make_method_def(name, m, declare, event=False):
def make_html_class(node):
div = ET.Element("div")
- div.attrib["class"] = "class";
+ div.attrib["class"] = "class"
a = ET.SubElement(div, "a")
a.attrib["name"] = node.attrib["name"]
@@ -482,7 +482,7 @@ def make_html_class(node):
ET.SubElement(div, "br")
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "inheritance";
+ div2.attrib["class"] = "inheritance"
span = ET.SubElement(div2, "span")
span.text = "Inherits: "
@@ -493,7 +493,7 @@ def make_html_class(node):
ET.SubElement(div, "br")
div3 = ET.SubElement(div, "div")
- div3.attrib["class"] = "category";
+ div3.attrib["class"] = "category"
span = ET.SubElement(div3, "span")
span.attrib["class"] = "category"
@@ -520,7 +520,7 @@ def make_html_class(node):
h4.text = "Public Methods:"
method_table = ET.SubElement(div, "table")
- method_table.attrib["class"] = "method_list";
+ method_table.attrib["class"] = "method_list"
for m in list(methods):
#li = ET.SubElement(div2, "li")
@@ -533,7 +533,7 @@ def make_html_class(node):
h4.text = "Events:"
event_table = ET.SubElement(div, "table")
- event_table.attrib["class"] = "method_list";
+ event_table.attrib["class"] = "method_list"
for m in list(events):
#li = ET.SubElement(div2, "li")
@@ -545,13 +545,13 @@ def make_html_class(node):
h4 = ET.SubElement(div, "h4")
h4.text = "Public Variables:"
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "member_list";
+ div2.attrib["class"] = "member_list"
for c in list(members):
li = ET.SubElement(div2, "li")
div3 = ET.SubElement(li, "div")
- div3.attrib["class"] = "member";
+ div3.attrib["class"] = "member"
make_type(c.attrib["type"], div3)
span = ET.SubElement(div3, "span")
span.attrib["class"] = "identifier member_name"
@@ -566,12 +566,12 @@ def make_html_class(node):
h4 = ET.SubElement(div, "h4")
h4.text = "Constants:"
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "constant_list";
+ div2.attrib["class"] = "constant_list"
for c in list(constants):
li = ET.SubElement(div2, "li")
div3 = ET.SubElement(li, "div")
- div3.attrib["class"] = "constant";
+ div3.attrib["class"] = "constant"
span = ET.SubElement(div3, "span")
span.attrib["class"] = "identifier constant_name"
@@ -614,10 +614,10 @@ def make_html_class(node):
descr = m.find("description")
if (descr == None or descr.text.strip() == ""):
- continue;
+ continue
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "method_doc";
+ div2.attrib["class"] = "method_doc"
div2.append(make_method_def(node.attrib["name"], m, True))
#anchor = ET.SubElement(div2, "a")
@@ -675,7 +675,7 @@ for cn in class_names:
css.attrib["type"] = "text/css"
body2 = ET.SubElement(html2, "body")
make_html_top(body2)
- body2.append(make_html_class(c));
+ body2.append(make_html_class(c))
make_html_bottom(body2)
et_out = ET.ElementTree(html2)
et_out.write(c.attrib["name"] + ".html")
diff --git a/drivers/SCsub b/drivers/SCsub
index 4ff770c7d..08a189272 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -5,31 +5,31 @@ Import('env')
env.drivers_sources = []
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
- SConscript("zlib/SCsub");
+ SConscript("zlib/SCsub")
# OS drivers
-SConscript('unix/SCsub');
-SConscript('windows/SCsub');
+SConscript('unix/SCsub')
+SConscript('windows/SCsub')
# Sounds drivers
-SConscript('alsa/SCsub');
-SConscript('pulseaudio/SCsub');
+SConscript('alsa/SCsub')
+SConscript('pulseaudio/SCsub')
if (env["platform"] == "windows"):
- SConscript("rtaudio/SCsub");
+ SConscript("rtaudio/SCsub")
if (env["xaudio2"] == "yes"):
- SConscript("xaudio2/SCsub");
+ SConscript("xaudio2/SCsub")
# Graphics drivers
-SConscript('gles2/SCsub');
-SConscript('gl_context/SCsub');
+SConscript('gles2/SCsub')
+SConscript('gl_context/SCsub')
# Core dependencies
-SConscript("png/SCsub");
+SConscript("png/SCsub")
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"] == "yes"):
- SConscript("convex_decomp/SCsub");
+ SConscript("convex_decomp/SCsub")
if env['vsproj'] == "yes":
env.AddToVSProject(env.drivers_sources)
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
index 26b6f7f06..bf4ec9485 100644
--- a/drivers/gles2/shaders/SCsub
+++ b/drivers/gles2/shaders/SCsub
@@ -3,10 +3,10 @@
Import('env')
if env['BUILDERS'].has_key('GLSL120GLES'):
- env.GLSL120GLES('material.glsl');
- env.GLSL120GLES('canvas.glsl');
- env.GLSL120GLES('canvas_shadow.glsl');
- env.GLSL120GLES('blur.glsl');
- env.GLSL120GLES('copy.glsl');
+ env.GLSL120GLES('material.glsl')
+ env.GLSL120GLES('canvas.glsl')
+ env.GLSL120GLES('canvas_shadow.glsl')
+ env.GLSL120GLES('blur.glsl')
+ env.GLSL120GLES('copy.glsl')
Export('env')
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index d3ece6519..aedde3e2b 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -33,7 +33,7 @@ if (env["libpng"] == "builtin"):
import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt":
env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
- env_neon = env_png.Clone();
+ env_neon = env_png.Clone()
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
neon_sources = []
diff --git a/methods.py b/methods.py
index 269e07640..91afd9e70 100755
--- a/methods.py
+++ b/methods.py
@@ -2,8 +2,8 @@ import os
def add_source_files(self, sources, filetype, lib_env=None, shared=False):
- import glob;
- import string;
+ import glob
+ import string
# if not lib_objects:
if not lib_env:
lib_env = self
@@ -101,8 +101,8 @@ def build_glsl_header(filename):
# texture unit
texunit = str(int(line[line.find(":") + 1:].strip()))
uline = line[:line.lower().find("//")]
- uline = uline.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = uline.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -120,9 +120,9 @@ def build_glsl_header(filename):
# ubo
uboidx = str(int(line[line.find(":") + 1:].strip()))
uline = line[:line.lower().find("//")]
- uline = uline[uline.find("uniform") + len("uniform"):];
- uline = uline.replace(";", "");
- uline = uline.replace("{", "");
+ uline = uline[uline.find("uniform") + len("uniform"):]
+ uline = uline.replace(";", "")
+ uline = uline.replace("{", "")
lines = uline.split(",")
for x in lines:
@@ -137,8 +137,8 @@ def build_glsl_header(filename):
ubo_names += [x]
else:
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -152,9 +152,9 @@ def build_glsl_header(filename):
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 ", "");
- uline = uline.replace(";", "");
+ uline = line.replace("in ", "")
+ uline = uline.replace("attribute ", "")
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -165,8 +165,8 @@ def build_glsl_header(filename):
attributes += [(name, bind)]
if (line.strip().find("out ") == 0):
- uline = line.replace("out", "").strip();
- uline = uline.replace(";", "");
+ uline = line.replace("out", "").strip()
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -190,12 +190,12 @@ def build_glsl_header(filename):
line = fs.readline()
line_offset += 1
- fs.close();
+ fs.close()
out_file = filename + ".h"
fd = open(out_file, "w")
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -205,47 +205,47 @@ def build_glsl_header(filename):
fd.write("#ifndef " + out_file_ifdef + "\n")
fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL";
- fd.write("\n\n");
- fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n");
- fd.write("class " + out_file_class + " : public ShaderGL {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
- fd.write("public:\n\n");
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL"
+ fd.write("\n\n")
+ fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n")
+ fd.write("class " + out_file_class + " : public ShaderGL {\n\n")
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
+ fd.write("public:\n\n")
if (len(conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in conditionals:
- fd.write("\t\t" + x + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x + ",\n")
+ fd.write("\t};\n\n")
if (len(uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
- fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
+ fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\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");
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+ fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -276,7 +276,7 @@ def build_glsl_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
@@ -307,7 +307,7 @@ def build_glsl_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -321,18 +321,18 @@ def build_glsl_header(filename):
}
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init() {\n\n");
+ fd.write("\tvirtual void init() {\n\n")
if (len(conditionals)):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -341,8 +341,8 @@ def build_glsl_header(filename):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -350,62 +350,62 @@ def build_glsl_header(filename):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
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:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic FBOPair *_fbo_pairs=NULL;\n")
if (len(ubos)):
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
for x in ubos:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
if (len(texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in texunits:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
for x in vertex_lines:
- fd.write("\t\t\t" + x + "\n");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
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");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
fd.write("\t\tsetup(_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_attribute_pairs," + str(len(attributes)) + ",_fbo_pairs," + str(len(fbos)) + ",_ubo_pairs," + str(len(ubos)) + ",_texunit_pairs," + str(len(texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
- fd.write("};\n\n");
- fd.write("#endif\n\n");
- fd.close();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_glsl_headers(target, source, env):
for x in source:
- build_glsl_header(str(x));
+ build_glsl_header(str(x))
return 0
@@ -455,8 +455,8 @@ def build_hlsl_dx9_header(filename):
if (not ifdefline in conditionals):
conditionals += [ifdefline]
if (line.find("uniform") != -1):
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -483,12 +483,12 @@ def build_hlsl_dx9_header(filename):
line = fs.readline()
line_offset += 1
- fs.close();
+ fs.close()
out_file = filename + ".h"
fd = open(out_file, "w")
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -498,47 +498,47 @@ def build_hlsl_dx9_header(filename):
fd.write("#ifndef " + out_file_ifdef + "\n")
fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9";
- fd.write("\n\n");
- fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n");
- fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
- fd.write("public:\n\n");
+ out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9"
+ fd.write("\n\n")
+ fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n")
+ fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n")
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
+ fd.write("public:\n\n")
if (len(conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in conditionals:
- fd.write("\t\t" + x + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x + ",\n")
+ fd.write("\t};\n\n")
if (len(uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ 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");
-
- fd.write("\t#define _FU if (!_uniform_valid(p_uniform)) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU set_uniformb(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+
+ fd.write("\t#define _FU if (!_uniform_valid(p_uniform)) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU set_uniformb(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU float col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; set_uniformfv(p_uniform,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU float vec2[4]={p_vec2.x,p_vec2.y,0,0}; set_uniformfv(p_uniform,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU float vec3[4]={p_vec3.x,p_vec3.y,p_vec3.z,0}; set_uniformfv(p_uniform,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU float vec2[4]={p_a,p_b,0,0}; set_uniformfv(p_uniform,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU float vec3[4]={p_a,p_b,p_c,0}; set_uniformfv(p_uniform,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU float vec4[4]={p_a,p_b,p_c,p_d}; set_uniformfv(p_uniform,vec4); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU float col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; set_uniformfv(p_uniform,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU float vec2[4]={p_vec2.x,p_vec2.y,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU float vec3[4]={p_vec3.x,p_vec3.y,p_vec3.z,0}; set_uniformfv(p_uniform,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU float vec2[4]={p_a,p_b,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU float vec3[4]={p_a,p_b,p_c,0}; set_uniformfv(p_uniform,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU float vec4[4]={p_a,p_b,p_c,p_d}; set_uniformfv(p_uniform,vec4); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -567,7 +567,7 @@ def build_hlsl_dx9_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -581,18 +581,18 @@ def build_hlsl_dx9_header(filename):
}
set_uniformfv(p_uniform,&matrix[0],4);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n");
+ fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n")
if (len(conditionals)):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -601,49 +601,49 @@ def build_hlsl_dx9_header(filename):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
fd.write("\t\tstatic const bool _fragment_uniforms[]={\n")
if (len(uniforms)):
for x in fragment_uniforms:
if (x):
- fd.write("\t\t\ttrue,\n");
+ fd.write("\t\t\ttrue,\n")
else:
- fd.write("\t\t\tfalse,\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\tfalse,\n")
+ fd.write("\t\t};\n\n")
else:
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");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
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");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
fd.write("\t\tsetup(p_device,p_version,_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_fragment_uniforms,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
- fd.write("};\n\n");
- fd.write("#endif\n\n");
- fd.close();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_hlsl_dx9_headers(target, source, env):
for x in source:
- build_hlsl_dx9_header(str(x));
+ build_hlsl_dx9_header(str(x))
return 0
@@ -717,14 +717,14 @@ def include_file_in_legacygl_header(filename, header_data, depth):
ifdefline = ifdefline.replace(")", "").strip()
if (line.find("_EN_") != -1):
- enumbase = ifdefline[:ifdefline.find("_EN_")];
+ enumbase = ifdefline[:ifdefline.find("_EN_")]
ifdefline = ifdefline.replace("_EN_", "_")
line = line.replace("_EN_", "_")
# print(enumbase+":"+ifdefline);
if (enumbase not in header_data.enums):
header_data.enums[enumbase] = []
if (ifdefline not in header_data.enums[enumbase]):
- header_data.enums[enumbase].append(ifdefline);
+ header_data.enums[enumbase].append(ifdefline)
elif (not ifdefline in header_data.conditionals):
header_data.conditionals += [ifdefline]
@@ -737,9 +737,9 @@ def include_file_in_legacygl_header(filename, header_data, depth):
else:
texunit = str(int(texunitstr))
uline = line[:line.lower().find("//")]
- uline = uline.replace("uniform", "");
- uline = uline.replace("highp", "");
- uline = uline.replace(";", "");
+ uline = uline.replace("uniform", "")
+ uline = uline.replace("highp", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -754,8 +754,8 @@ def include_file_in_legacygl_header(filename, header_data, depth):
header_data.texunit_names += [x]
elif (line.find("uniform") != -1):
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -769,10 +769,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
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 ", "");
- uline = uline.replace("highp ", "");
- uline = uline.replace(";", "");
+ uline = line.replace("in ", "")
+ uline = uline.replace("attribute ", "")
+ uline = uline.replace("highp ", "")
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -796,7 +796,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
line = fs.readline()
header_data.line_offset += 1
- fs.close();
+ fs.close()
return header_data
@@ -811,7 +811,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
enum_constants = []
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -821,49 +821,49 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n")
fd.write("#define " + out_file_ifdef + class_suffix + "_120\n")
- out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix;
- fd.write("\n\n");
- fd.write("#include \"" + include + "\"\n\n\n");
- 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");
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix
+ fd.write("\n\n")
+ fd.write("#include \"" + include + "\"\n\n\n")
+ 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");
+ fd.write("public:\n\n")
if (len(header_data.conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in header_data.conditionals:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
if (len(header_data.uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in header_data.uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
- fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
+ fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
if (len(header_data.conditionals)):
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n");
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+ fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -894,7 +894,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
@@ -925,7 +925,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -939,17 +939,17 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init() {\n\n");
+ fd.write("\tvirtual void init() {\n\n")
- enum_value_count = 0;
+ enum_value_count = 0
if (len(header_data.enums)):
- fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n");
+ fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n")
fd.write("\t\tstatic const Enum _enums[]={\n")
bitofs = len(header_data.conditionals)
@@ -958,7 +958,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
for xv in header_data.enums:
x = header_data.enums[xv]
bits = 1
- amt = len(x);
+ amt = len(x)
# print(x)
while(2**bits < amt):
bits += 1
@@ -975,18 +975,18 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
strs += "NULL}"
- fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n");
+ 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\t};\n\n")
fd.write("\t\tstatic const EnumValue _enum_values[]={\n")
- enum_value_count = len(enum_vals);
+ enum_value_count = len(enum_vals)
for x in enum_vals:
- fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n");
+ fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n")
- fd.write("\t\t};\n\n");
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const Enum *_enums=NULL;\n")
fd.write("\t\tstatic const EnumValue *_enum_values=NULL;\n")
@@ -996,8 +996,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(header_data.conditionals)):
for x in header_data.conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -1006,8 +1006,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(header_data.uniforms)):
for x in header_data.uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -1016,36 +1016,36 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in header_data.attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
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:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:
for i in range(len(x)):
- fd.write(str(ord(x[i])) + ",");
+ fd.write(str(ord(x[i])) + ",")
- fd.write(str(ord('\n')) + ",");
- fd.write("\t\t0};\n\n");
+ fd.write(str(ord('\n')) + ",")
+ fd.write("\t\t0};\n\n")
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)):
- fd.write(str(ord(x[i])) + ",");
+ fd.write(str(ord(x[i])) + ",")
- fd.write(str(ord('\n')) + ",");
- fd.write("\t\t0};\n\n");
+ fd.write(str(ord('\n')) + ",")
+ fd.write("\t\t0};\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
@@ -1060,20 +1060,20 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\tenum EnumConditionals {\n")
for x in enum_constants:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ 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();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_legacygl_headers(target, source, env):
for x in source:
- build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False);
+ build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False)
return 0
@@ -1120,22 +1120,22 @@ def parse_cg_file(fname, uniforms, sizes, conditionals):
type = res.groups(1)
name = res.groups(2)
- uniforms.append(name);
+ uniforms.append(name)
if (type.find("texobj") != -1):
- sizes.append(1);
+ sizes.append(1)
else:
- t = re.match(r"float(\d)x(\d)", type);
+ t = re.match(r"float(\d)x(\d)", type)
if t:
sizes.append(int(t.groups(1)) * int(t.groups(2)))
else:
- t = re.match(r"float(\d)", type);
+ t = re.match(r"float(\d)", type)
sizes.append(int(t.groups(1)))
if line.find("[branch]") != -1:
- conditionals.append(name);
+ conditionals.append(name)
- line = fs.readline();
+ line = fs.readline()
def build_cg_shader(sname):
@@ -1144,36 +1144,36 @@ def build_cg_shader(sname):
vp_uniform_sizes = []
vp_conditionals = []
- parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals);
+ parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals)
fp_uniforms = []
fp_uniform_sizes = []
fp_conditionals = []
- parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals);
+ parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals)
- fd = open("shader_" + sname + ".cg.h", "w");
+ fd = open("shader_" + sname + ".cg.h", "w")
- fd.write('\n#include "shader_cell.h"\n');
- fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n");
- fd.write("\n\tstatic struct VertexUniforms[] = {\n");
+ fd.write('\n#include "shader_cell.h"\n')
+ fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n")
+ fd.write("\n\tstatic struct VertexUniforms[] = {\n")
- offset = 0;
+ offset = 0
for i in range(0, len(vp_uniforms)):
fd.write('\t\t{ "%s", %d, %d },\n' % (vp_uniforms[i], offset, vp_uniform_sizes[i]))
- offset = offset + vp_uniform_sizes[i];
- fd.write("\t};\n\n");
+ offset = offset + vp_uniform_sizes[i]
+ fd.write("\t};\n\n")
- fd.write("public:\n\n");
+ fd.write("public:\n\n")
- fd.write("\tenum {\n");
+ fd.write("\tenum {\n")
for i in range(0, len(vp_uniforms)):
fd.write('\t\tVP_%s,\n' % vp_uniforms[i].upper())
- fd.write("\t};\n");
+ fd.write("\t};\n")
import glob
@@ -1440,13 +1440,13 @@ def save_active_platforms(apnames, ap):
for x in ap:
pth = x + "/logo.png"
# print("open path: "+pth)
- pngf = open(pth, "rb");
- b = pngf.read(1);
+ pngf = open(pth, "rb")
+ b = pngf.read(1)
str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
str += " static const unsigned char _" + x[9:] + "_logo[]={"
while(len(b) == 1):
str += hex(ord(b))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
str += ","
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index 75ea9b6bd..bac80fb76 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -682,6 +682,6 @@ env_openssl.add_source_files(env.modules_sources, "*.c")
# platform/winrt need to know openssl is available, pass to main env
if "platform" in env and env["platform"] == "winrt":
env.Append(CPPPATH=[thirdparty_dir])
- env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
+ env.Append(CPPFLAGS=['-DOPENSSL_ENABLED'])
Export('env')
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 5de4f1144..d52bb57c0 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -49,7 +49,7 @@ def create(env):
if "applelink" in tools:
tools.remove("applelink")
env.Tool('gcc')
- return env.Clone(tools=tools);
+ return env.Clone(tools=tools)
def configure(env):
@@ -124,7 +124,7 @@ def configure(env):
else:
env.extra_suffix = ".armv7" + env.extra_suffix
- gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/";
+ gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/"
if (sys.platform.startswith("linux")):
if (platform.machine().endswith('64')):
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 7e71faa37..38f789259 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -23,7 +23,7 @@ iphone_lib = [
#iphone_lib = env.Library('iphone', iphone_lib)
-env_ios = env.Clone();
+env_ios = env.Clone()
if env['ios_gles22_override'] == "yes":
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 04a6bc9cc..ec9939298 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -39,7 +39,7 @@ def get_flags():
def configure(env):
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
env.use_windows_spawn_fix('javascript')
env.Append(CPPPATH=['#platform/javascript'])
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 93d29a360..0576b0bfa 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -267,7 +267,7 @@ def configure(env):
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
# This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
@@ -323,10 +323,10 @@ def configure(env):
env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix = env["mingw_prefix"];
+ mingw_prefix = env["mingw_prefix"]
else:
env.Append(LINKFLAGS=['-static'])
- mingw_prefix = env["mingw_prefix_64"];
+ mingw_prefix = env["mingw_prefix_64"]
nulstr = ""
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index 15ac42968..2156e593e 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -49,7 +49,7 @@ def configure(env):
sys.exit()
arch = ""
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
diff --git a/scene/SCsub b/scene/SCsub
index 4a89eef46..bd2da1eab 100644
--- a/scene/SCsub
+++ b/scene/SCsub
@@ -7,14 +7,14 @@ env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
-SConscript('main/SCsub');
-SConscript('gui/SCsub');
-SConscript('3d/SCsub');
-SConscript('2d/SCsub');
-SConscript('animation/SCsub');
-SConscript('audio/SCsub');
-SConscript('resources/SCsub');
-SConscript('io/SCsub');
+SConscript('main/SCsub')
+SConscript('gui/SCsub')
+SConscript('3d/SCsub')
+SConscript('2d/SCsub')
+SConscript('animation/SCsub')
+SConscript('audio/SCsub')
+SConscript('resources/SCsub')
+SConscript('io/SCsub')
lib = env.Library("scene", env.scene_sources)
diff --git a/scene/resources/SCsub b/scene/resources/SCsub
index 9c1e72f04..60b16cd0d 100644
--- a/scene/resources/SCsub
+++ b/scene/resources/SCsub
@@ -7,4 +7,4 @@ env.add_source_files(env.scene_sources, "*.c")
Export('env')
-SConscript("default_theme/SCsub");
+SConscript("default_theme/SCsub")
diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py
index 41d5e2e25..68c9e9252 100644
--- a/scene/resources/default_theme/make_header.py
+++ b/scene/resources/default_theme/make_header.py
@@ -1,71 +1,71 @@
-import os;
-import glob;
-import string;
+import os
+import glob
+import string
# Generate include files
f = open("theme_data.h", "wb")
-f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
+f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n")
-f.write("\n\n");
+f.write("\n\n")
# Generate png image block
-pixmaps = glob.glob("*.png");
+pixmaps = glob.glob("*.png")
-pixmaps.sort();
+pixmaps.sort()
-f.write("\n\n\n");
+f.write("\n\n\n")
for x in pixmaps:
- var_str = x[:-4] + "_png";
+ var_str = x[:-4] + "_png"
- f.write("static const unsigned char " + var_str + "[]={\n");
+ f.write("static const unsigned char " + var_str + "[]={\n")
- pngf = open(x, "rb");
+ pngf = open(x, "rb")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
f.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
f.write(",")
- f.write("\n};\n\n\n");
- pngf.close();
+ f.write("\n};\n\n\n")
+ pngf.close()
# Generate shaders block
shaders = glob.glob("*.gsl")
-shaders.sort();
+shaders.sort()
-f.write("\n\n\n");
+f.write("\n\n\n")
for x in shaders:
- var_str = x[:-4] + "_shader_code";
+ var_str = x[:-4] + "_shader_code"
- f.write("static const char *" + var_str + "=\n");
+ f.write("static const char *" + var_str + "=\n")
- sf = open(x, "rb");
+ sf = open(x, "rb")
- b = sf.readline();
+ b = sf.readline()
while(b != ""):
if (b.endswith("\r\n")):
b = b[:-2]
if (b.endswith("\n")):
b = b[:-1]
f.write(" \"" + b)
- b = sf.readline();
+ b = sf.readline()
if (b != ""):
f.write("\"\n")
- f.write("\";\n\n\n");
- sf.close();
+ f.write("\";\n\n\n")
+ sf.close()
-f.close();
+f.close()
diff --git a/servers/SCsub b/servers/SCsub
index 8fab6c1dc..eefa6278c 100644
--- a/servers/SCsub
+++ b/servers/SCsub
@@ -7,12 +7,12 @@ env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
-SConscript('physics/SCsub');
-SConscript('physics_2d/SCsub');
-SConscript('visual/SCsub');
-SConscript('audio/SCsub');
-SConscript('spatial_sound/SCsub');
-SConscript('spatial_sound_2d/SCsub');
+SConscript('physics/SCsub')
+SConscript('physics_2d/SCsub')
+SConscript('visual/SCsub')
+SConscript('audio/SCsub')
+SConscript('spatial_sound/SCsub')
+SConscript('spatial_sound_2d/SCsub')
lib = env.Library("servers", env.servers_sources)
diff --git a/tools/SCsub b/tools/SCsub
index f11aa34ee..43cad794d 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -47,11 +47,11 @@ def make_translations_header(target, source, env):
xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n")
- g.write("\tconst char* lang;\n");
- g.write("\tint comp_size;\n");
- g.write("\tint uncomp_size;\n");
- g.write("\tconst unsigned char* data;\n");
- g.write("};\n\n");
+ g.write("\tconst char* lang;\n")
+ g.write("\tint comp_size;\n")
+ g.write("\tint uncomp_size;\n")
+ g.write("\tconst unsigned char* data;\n")
+ g.write("};\n\n")
g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names:
g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
@@ -112,8 +112,8 @@ if (env["tools"] != "no"):
env.Depends('#tools/editor/builtin_fonts.h', flist)
env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
- SConscript('editor/SCsub');
- SConscript('collada/SCsub');
+ SConscript('editor/SCsub')
+ SConscript('collada/SCsub')
SConscript('doc/SCsub')
lib = env.Library("tool", env.tool_sources)
diff --git a/tools/editor/SCsub b/tools/editor/SCsub
index 625103eae..caf45d25b 100644
--- a/tools/editor/SCsub
+++ b/tools/editor/SCsub
@@ -74,7 +74,7 @@ if (env["tools"] == "yes"):
env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
- SConscript('icons/SCsub');
- SConscript('plugins/SCsub');
- SConscript('fileserver/SCsub');
- SConscript('io_plugins/SCsub');
+ SConscript('icons/SCsub')
+ SConscript('plugins/SCsub')
+ SConscript('fileserver/SCsub')
+ SConscript('io_plugins/SCsub')
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index f27350a18..af6ebd67f 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -22,42 +22,42 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps:
x = str(x)
- var_str = os.path.basename(x)[:-4] + "_png";
+ var_str = os.path.basename(x)[:-4] + "_png"
# print(var_str)
- s.write("static const unsigned char " + var_str + "[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n")
- pngf = open(x, "rb");
+ pngf = open(x, "rb")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
s.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
s.write(",")
- s.write("\n};\n\n");
+ s.write("\n};\n\n")
- pngf.close();
- var_str = os.path.basename(x)[:-4] + "_hidpi_png";
+ pngf.close()
+ var_str = os.path.basename(x)[:-4] + "_hidpi_png"
try:
pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb")
- s.write("static const unsigned char " + var_str + "[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
s.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
s.write(",")
- s.write("\n};\n\n\n");
+ s.write("\n};\n\n\n")
hidpi_list.append(x)
except:
- s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n");
+ 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")
@@ -74,12 +74,12 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps:
x = os.path.basename(str(x))
- type = x[5:-4].title().replace("_", "");
- var_str = x[:-4] + "_png";
- var_str_hidpi = x[:-4] + "_hidpi_png";
- s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n");
+ type = x[5:-4].title().replace("_", "")
+ var_str = x[:-4] + "_png"
+ var_str_hidpi = x[:-4] + "_hidpi_png"
+ s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n")
- s.write("\n\n}\n\n");
+ s.write("\n\n}\n\n")
f = open(dst, "wb")
f.write(s.getvalue())
diff --git a/tools/scripts/file-hex-array.py b/tools/scripts/file-hex-array.py
index da95c9505..a6cdfe541 100755
--- a/tools/scripts/file-hex-array.py
+++ b/tools/scripts/file-hex-array.py
@@ -9,7 +9,8 @@ def tof(filepath):
content = content.replace("0x", "")
content = content.split(',')
for i in range(len(content)):
- if len(content[i]) == 1: content[i] = "0" + content[i]
+ if len(content[i]) == 1:
+ content[i] = "0" + content[i]
content = "".join(content)
with open(filepath + ".file", 'wb') as f:
content = f.write(content.decode("hex"))
diff --git a/tools/scripts/make_glwrapper.py b/tools/scripts/make_glwrapper.py
index bae0eeead..5694d2327 100644
--- a/tools/scripts/make_glwrapper.py
+++ b/tools/scripts/make_glwrapper.py
@@ -61,7 +61,7 @@ for x in (range(len(sys.argv) - 1)):
if (glpos == -1):
continue
- ret = line[:glpos].strip();
+ ret = line[:glpos].strip()
line = line[glpos:].strip()
namepos = line.find("(")
@@ -127,14 +127,14 @@ header_code = """\
f.write("#include \n\n\n")
-f.write(header_code);
+f.write(header_code)
f.write("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n")
f.write("#if defined(_WIN32) && !defined(__CYGWIN__)\n")
f.write("#define GLWRP_APIENTRY __stdcall\n")
-f.write("#else\n");
+f.write("#else\n")
f.write("#define GLWRP_APIENTRY \n")
-f.write("#endif\n\n");
+f.write("#endif\n\n")
for x in types:
f.write(x + "\n")
@@ -150,7 +150,7 @@ for x in functions:
f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n")
f.write("\n\n")
-f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n");
+f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n")
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n")
f.write("#ifdef __cplusplus\n}\n#endif\n")
--
cgit v1.2.3-70-g09d2