From 97531819567e78f8dc5e06308fe7080d17acc334 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Fri, 29 May 2020 03:02:32 +0300 Subject: [PATCH] SCons: Allow to read `custom_modules` option via a file The `custom_modules` option was only read via the command line by fetching `ARGUMENTS` dictionary directly. Instead, the option's value can now be read via any existing configuration files (`custom.py`) as well as command line, while also updating the environment. (cherry picked from commit 6304d16915e7dec0b699c2f8789d4bbfef5da66d) --- SConstruct | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 5af851a9b28..5caca8e8f33 100644 --- a/SConstruct +++ b/SConstruct @@ -177,12 +177,16 @@ for k in platform_opts.keys(): for o in opt_list: opts.Add(o) +# Update the environment now as the "custom_modules" option may be +# defined in a file rather than specified via the command line. +opts.Update(env_base) + # Detect modules. modules_detected = OrderedDict() module_search_paths = ["modules"] # Built-in path. -if ARGUMENTS.get("custom_modules"): - paths = ARGUMENTS.get("custom_modules").split(",") +if env_base["custom_modules"]: + paths = env_base["custom_modules"].split(",") for p in paths: try: module_search_paths.append(methods.convert_custom_modules_path(p)) @@ -213,8 +217,9 @@ for name, path in modules_detected.items(): methods.write_modules(modules_detected) -opts.Update(env_base) # update environment -Help(opts.GenerateHelpText(env_base)) # generate help +# Update the environment again after all the module options are added. +opts.Update(env_base) +Help(opts.GenerateHelpText(env_base)) # add default include paths