diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-30 08:28:32 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-30 09:05:53 +0200 |
commit | cd4e46ee65dab6baa6a143bf3b3f64244be36712 (patch) | |
tree | 689e53265691e782ae35a961445c975219e1155d /modules/mono/SCsub | |
parent | 0168709978154a89f137b44f33647e5d28a46250 (diff) |
SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.
psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:
- Manually wrapped strings will be reflowed, so by using a line length
of 120 for the sake of preserving readability for our long command
calls, it also means that some manually wrapped strings are back on
the same line and should be manually merged again.
- Code generators using string concatenation extensively look awful,
since black puts each operand on a single line. We need to refactor
these generators to use more pythonic string formatting, for which
many options are available (`%`, `format` or f-strings).
- CI checks and a pre-commit hook will be added to ensure that future
buildsystem changes are well-formatted.
Diffstat (limited to 'modules/mono/SCsub')
-rw-r--r-- | modules/mono/SCsub | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/modules/mono/SCsub b/modules/mono/SCsub index 5f03fafdcf..af77913b91 100644 --- a/modules/mono/SCsub +++ b/modules/mono/SCsub @@ -2,46 +2,50 @@ import build_scripts.mono_configure as mono_configure -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_mono = env_modules.Clone() -if env_mono['tools']: +if env_mono["tools"]: # NOTE: It is safe to generate this file here, since this is still executed serially import build_scripts.gen_cs_glue_version as gen_cs_glue_version - gen_cs_glue_version.generate_header('glue/GodotSharp', 'glue/cs_glue_version.gen.h') + + gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h") # Glue sources -if env_mono['mono_glue']: - env_mono.Append(CPPDEFINES=['MONO_GLUE_ENABLED']) +if env_mono["mono_glue"]: + env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"]) import os.path - if not os.path.isfile('glue/mono_glue.gen.cpp'): + + if not os.path.isfile("glue/mono_glue.gen.cpp"): raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?") -if env_mono['tools'] or env_mono['target'] != 'release': - env_mono.Append(CPPDEFINES=['GD_MONO_HOT_RELOAD']) +if env_mono["tools"] or env_mono["target"] != "release": + env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"]) # Configure Mono mono_configure.configure(env, env_mono) -if env_mono['tools'] and env_mono['mono_glue']: +if env_mono["tools"] and env_mono["mono_glue"]: # Build Godot API solution import build_scripts.api_solution_build as api_solution_build + api_sln_cmd = api_solution_build.build(env_mono) # Build GodotTools import build_scripts.godot_tools_build as godot_tools_build + godot_tools_build.build(env_mono, api_sln_cmd) # Add sources -env_mono.add_source_files(env.modules_sources, '*.cpp') -env_mono.add_source_files(env.modules_sources, 'glue/*.cpp') -env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp') -env_mono.add_source_files(env.modules_sources, 'utils/*.cpp') +env_mono.add_source_files(env.modules_sources, "*.cpp") +env_mono.add_source_files(env.modules_sources, "glue/*.cpp") +env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp") +env_mono.add_source_files(env.modules_sources, "utils/*.cpp") -if env['tools']: - env_mono.add_source_files(env.modules_sources, 'editor/*.cpp') +if env["tools"]: + env_mono.add_source_files(env.modules_sources, "editor/*.cpp") |