[master] Run black format on SConstruct files and bindings generator

pull/712/head
Aaron Franke 2022-02-26 14:45:00 -06:00
parent 8ead641b08
commit 101d61b64a
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
3 changed files with 21 additions and 6 deletions

View File

@ -9,7 +9,6 @@ if sys.version_info < (3,):
def decode_utf8(x): def decode_utf8(x):
return x return x
else: else:
import codecs import codecs
@ -265,7 +264,7 @@ elif env["platform"] == "ios":
env.Append(CCFLAGS=["-arch", env["ios_arch"]]) env.Append(CCFLAGS=["-arch", env["ios_arch"]])
env.Append(CCFLAGS=["-isysroot", sdk_path]) env.Append(CCFLAGS=["-isysroot", sdk_path])
env.Append(LINKFLAGS=["-isysroot", sdk_path, "-F" + sdk_path,]) env.Append(LINKFLAGS=["-isysroot", sdk_path, "-F" + sdk_path])
if env["target"] == "debug": if env["target"] == "debug":
env.Append(CCFLAGS=["-Og", "-g"]) env.Append(CCFLAGS=["-Og", "-g"])

View File

@ -623,7 +623,9 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
# Move constructor. # Move constructor.
result.append(f"{class_name}::{class_name}({class_name} &&other) {{") result.append(f"{class_name}::{class_name}({class_name} &&other) {{")
if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0: if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0:
result.append(f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &other);") result.append(
f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &other);"
)
else: else:
result.append("\tstd::swap(opaque, other.opaque);") result.append("\tstd::swap(opaque, other.opaque);")
result.append("}") result.append("}")
@ -741,7 +743,9 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
# Move assignment. # Move assignment.
result.append(f"{class_name} &{class_name}::operator=({class_name} &&other) {{") result.append(f"{class_name} &{class_name}::operator=({class_name} &&other) {{")
if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0: if needs_copy_instead_of_move(class_name) and copy_constructor_index >= 0:
result.append(f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &other);") result.append(
f"\tinternal::_call_builtin_constructor(_method_bindings.constructor_{copy_constructor_index}, &opaque, &other);"
)
else: else:
result.append("\tstd::swap(opaque, other.opaque);") result.append("\tstd::swap(opaque, other.opaque);")
result.append("\treturn *this;") result.append("\treturn *this;")
@ -1626,6 +1630,7 @@ def is_packed_array(type_name):
"PackedVector3Array", "PackedVector3Array",
] ]
def needs_copy_instead_of_move(type_name): def needs_copy_instead_of_move(type_name):
""" """
Those are types which need initialised data or we'll get warning spam so need a copy instead of move. Those are types which need initialised data or we'll get warning spam so need a copy instead of move.
@ -1634,6 +1639,7 @@ def needs_copy_instead_of_move(type_name):
"Dictionary", "Dictionary",
] ]
def is_enum(type_name): def is_enum(type_name):
return type_name.startswith("enum::") return type_name.startswith("enum::")

View File

@ -17,8 +17,18 @@ env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp") sources = Glob("src/*.cpp")
if env["platform"] == "osx": if env["platform"] == "osx":
library = env.SharedLibrary("demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(env["platform"], env["target"], env["platform"], env["target"]), source=sources) library = env.SharedLibrary(
"demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else: else:
library = env.SharedLibrary("demo/bin/libgdexample.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"]), source=sources) library = env.SharedLibrary(
"demo/bin/libgdexample.{}.{}.{}{}".format(
env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"]
),
source=sources,
)
Default(library) Default(library)