diff --git a/HISTORY.rst b/HISTORY.rst index 17be25e1..7a6a93cd 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,8 @@ test-driven methodologies, and modern toolchains for unrivaled success. 6.1.13 (2024-??-??) ~~~~~~~~~~~~~~~~~~~ +* Expanded support for SCons variables declared in the legacy format ``${SCONS_VARNAME}`` (`issue #4828 `_) + 6.1.12 (2024-01-10) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/project/config.py b/platformio/project/config.py index 3d92a5ae..f138f26c 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -164,6 +164,7 @@ class ProjectConfigBase: @staticmethod def get_section_scope(section): + assert section return section.split(":", 1)[0] if ":" in section else section def walk_options(self, root_section): @@ -343,8 +344,11 @@ class ProjectConfigBase: section, option = match.group(1), match.group(2) # handle built-in variables - if section is None and option in self.BUILTIN_VARS: - return self.BUILTIN_VARS[option]() + if section is None: + if option in self.BUILTIN_VARS: + return self.BUILTIN_VARS[option]() + # SCons varaibles + return f"${option}" # handle system environment variables if section == "sysenv": diff --git a/tests/project/test_config.py b/tests/project/test_config.py index 3f368fe1..c15aa7bc 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -657,7 +657,9 @@ build_dir = /tmp/pio-$PROJECT_HASH data_dir = $PROJECT_DIR/assets [env:myenv] -build_flags = -D UTIME=${UNIX_TIME} +build_flags = + -D UTIME=${UNIX_TIME} + -I ${PROJECTSRC_DIR}/hal test_testing_command = ${platformio.packages_dir}/tool-simavr/bin/simavr -m @@ -672,6 +674,7 @@ test_testing_command = os.path.join("$PROJECT_DIR", "assets") ) assert config.get("env:myenv", "build_flags")[0][-10:].isdigit() + assert config.get("env:myenv", "build_flags")[1] == "-I $PROJECTSRC_DIR/hal" testing_command = config.get("env:myenv", "test_testing_command") assert "$" not in " ".join(testing_command)