Rectified an issue where ${platformio.name} erroneously represented None as the default project name // Resolve #4717

This commit is contained in:
Ivan Kravets
2023-12-08 19:38:50 +02:00
parent 8c61f0f6b6
commit 127b422d25
3 changed files with 26 additions and 0 deletions

View File

@ -24,6 +24,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
* Drastically enhanced the speed of project building when operating in verbose mode (`issue #4783 <https://github.com/platformio/platformio-core/issues/4783>`_)
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)
* Enhanced the handling of built-in variables in |PIOCONF| during |INTERPOLATION| (`issue #4695 <https://github.com/platformio/platformio-core/issues/4695>`_)
* Rectified an issue where ``${platformio.name}`` erroneously represented ``None`` as the default `project name <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/generic/name.html>`__ (`issue #4717 <https://github.com/platformio/platformio-core/issues/4717>`_)
* Resolved an issue where the ``COMPILATIONDB_INCLUDE_TOOLCHAIN`` setting was not correctly applying to private libraries (`issue #4762 <https://github.com/platformio/platformio-core/issues/4762>`_)
* Resolved an issue where ``get_systype()`` inaccurately returned the architecture when executed within a Docker container on a 64-bit kernel with a 32-bit userspace (`issue #4777 <https://github.com/platformio/platformio-core/issues/4777>`_)
* Resolved an issue with incorrect handling of the ``check_src_filters`` option when used in multiple environments (`issue #4788 <https://github.com/platformio/platformio-core/issues/4788>`_)

View File

@ -110,6 +110,7 @@ ProjectOptions = OrderedDict(
group="generic",
name="name",
description="A project name",
default=lambda: os.path.basename(os.getcwd()),
),
ConfigPlatformioOption(
group="generic",

View File

@ -624,6 +624,30 @@ custom_option = ${this.board}
assert config.get("env:myenv", "build_flags") == ["-Dmyenv"]
def test_project_name(tmp_path: Path):
project_dir = tmp_path / "my-project-name"
project_dir.mkdir()
project_conf = project_dir / "platformio.ini"
project_conf.write_text(
"""
[env:myenv]
"""
)
with fs.cd(str(project_dir)):
config = ProjectConfig(str(project_conf))
assert config.get("platformio", "name") == "my-project-name"
# custom name
project_conf.write_text(
"""
[platformio]
name = custom-project-name
"""
)
config = ProjectConfig(str(project_conf))
assert config.get("platformio", "name") == "custom-project-name"
def test_nested_interpolation(tmp_path: Path):
project_conf = tmp_path / "platformio.ini"
project_conf.write_text(