From a1af1e87ae885df887c57e72407b625b355daf08 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Sun, 30 Jul 2023 12:23:04 -0400 Subject: [PATCH] Add support to import custom variables from parent SConstruct --- .gitignore | 1 + SConstruct | 4 ++++ test/SConstruct | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7c87766fb..bf554a3cb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ src/gen # Build configuarion. /custom.py +/test/custom.py # Misc logs/* diff --git a/SConstruct b/SConstruct index 11ec4cfbd..1e011a071 100644 --- a/SConstruct +++ b/SConstruct @@ -80,6 +80,10 @@ if env.GetOption("num_jobs") == altered_num_jobs: # Custom options and profile flags. customs = ["custom.py"] +try: + customs += Import("customs") +except: + pass profile = ARGUMENTS.get("profile", "") if profile: if os.path.isfile(profile): diff --git a/test/SConstruct b/test/SConstruct index 1732ecd43..8904faa57 100644 --- a/test/SConstruct +++ b/test/SConstruct @@ -2,7 +2,8 @@ import os import sys -env = SConscript("../SConstruct") +customs = ["custom.py"] +env = SConscript("../SConstruct", {"customs": [os.path.abspath(custom) for custom in customs]}) # For the reference: # - CCFLAGS are compilation flags shared between C and C++