From 8a38442bba9e8e804e10997d64c4a4854687ac16 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 5 Jul 2023 15:13:22 +0300 Subject: [PATCH 1/7] Bump version to 6.1.9a1 --- HISTORY.rst | 3 +++ platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 2aa67744..c60293e4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,9 @@ PlatformIO Core 6 **A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** +6.1.9 (2023-??-??) +~~~~~~~~~~~~~~~~~~ + 6.1.8 (2023-07-05) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 75b51791..a3ef8c17 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, 8) +VERSION = (6, 1, "9a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 25c7c60f0d2c686ff922cf80cc21425a712f92f0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 5 Jul 2023 15:30:40 +0300 Subject: [PATCH 2/7] Install "wheel" package for package publishing --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 3f0a4529..370333a5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox + pip install tox wheel - name: Deployment Tests env: From 109c537d86bba3b57bc3e15a1e09613f27af3be6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 11:40:30 +0300 Subject: [PATCH 3/7] Fixed handling of ``-include`` flag // Resolve #4683 --- HISTORY.rst | 2 ++ platformio/builder/tools/piobuild.py | 6 ++---- tests/commands/test_run.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c60293e4..63f54eec 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,8 @@ PlatformIO Core 6 6.1.9 (2023-??-??) ~~~~~~~~~~~~~~~~~~ +* Rectified a regression bug that occurred when the ``-include`` flag was passed via the `build_flags `__ option as a relative path and subsequently expanded (`issue #4683 `_) + 6.1.8 (2023-07-05) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piobuild.py b/platformio/builder/tools/piobuild.py index 1646dc95..23d0c6ff 100644 --- a/platformio/builder/tools/piobuild.py +++ b/platformio/builder/tools/piobuild.py @@ -201,15 +201,13 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches for k in ("CPPPATH", "LIBPATH"): for i, p in enumerate(result.get(k, [])): p = env.subst(p) - if os.path.isdir(p): - result[k][i] = os.path.abspath(p) + result[k][i] = p if os.path.isabs(p) else env.Dir(f"#{p}") # fix relative path for "-include" for i, f in enumerate(result.get("CCFLAGS", [])): if isinstance(f, tuple) and f[0] == "-include": p = env.subst(f[1].get_path()) - if os.path.exists(p): - result["CCFLAGS"][i] = (f[0], os.path.abspath(p)) + result["CCFLAGS"][i] = (f[0], p if os.path.isabs(p) else env.File(f"#{p}")) return result diff --git a/tests/commands/test_run.py b/tests/commands/test_run.py index de13a5a8..573ac9ef 100644 --- a/tests/commands/test_run.py +++ b/tests/commands/test_run.py @@ -22,7 +22,10 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir): ("-D TEST_INT=13", "-DTEST_INT=13"), ("-DTEST_SINGLE_MACRO", "-DTEST_SINGLE_MACRO"), ('-DTEST_STR_SPACE="Andrew Smith"', '"-DTEST_STR_SPACE=Andrew Smith"'), + ("-Iinclude", "-Iinclude"), + ("-include cpppath-include.h", "cpppath-include.h"), ("-Iextra_inc", "-Iextra_inc"), + ("-Inon-existing-dir", "-Inon-existing-dir"), ( "-include $PROJECT_DIR/lib/component/component-forced-include.h", "component-forced-include.h", @@ -103,12 +106,22 @@ projenv.Append(CPPDEFINES="POST_SCRIPT_MACRO") #error "I_AM_FORCED_COMPONENT_INCLUDE" #endif +#ifndef I_AM_FORCED_CPPPATH_INCLUDE +#error "I_AM_FORCED_CPPPATH_INCLUDE" +#endif + #ifdef COMMENTED_MACRO #error "COMMENTED_MACRO" #endif int main() { } +""" + ) + + tmpdir.mkdir("include").join("cpppath-include.h").write( + """ +#define I_AM_FORCED_CPPPATH_INCLUDE """ ) component_dir = tmpdir.mkdir("lib").mkdir("component") From 5396882e75770fa96567cd11212da4674d6d1781 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 11:40:58 +0300 Subject: [PATCH 4/7] Bump version to 6.1.9rc1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index a3ef8c17..79281da5 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "9a1") +VERSION = (6, 1, "9rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 9585e2a3e32efcb28273fe63a88a1d29fa0d3f2e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 13:42:19 +0300 Subject: [PATCH 5/7] Fixed handling of ``-include`` flag // Resolve #4683 --- platformio/builder/tools/piobuild.py | 6 +++--- tests/commands/test_run.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio/builder/tools/piobuild.py b/platformio/builder/tools/piobuild.py index 23d0c6ff..6fb2eb6f 100644 --- a/platformio/builder/tools/piobuild.py +++ b/platformio/builder/tools/piobuild.py @@ -201,13 +201,13 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches for k in ("CPPPATH", "LIBPATH"): for i, p in enumerate(result.get(k, [])): p = env.subst(p) - result[k][i] = p if os.path.isabs(p) else env.Dir(f"#{p}") + if os.path.isdir(p): + result[k][i] = os.path.abspath(p) # fix relative path for "-include" for i, f in enumerate(result.get("CCFLAGS", [])): if isinstance(f, tuple) and f[0] == "-include": - p = env.subst(f[1].get_path()) - result["CCFLAGS"][i] = (f[0], p if os.path.isabs(p) else env.File(f"#{p}")) + result["CCFLAGS"][i] = (f[0], env.subst(f[1].get_path())) return result diff --git a/tests/commands/test_run.py b/tests/commands/test_run.py index 573ac9ef..820de44f 100644 --- a/tests/commands/test_run.py +++ b/tests/commands/test_run.py @@ -25,7 +25,7 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir): ("-Iinclude", "-Iinclude"), ("-include cpppath-include.h", "cpppath-include.h"), ("-Iextra_inc", "-Iextra_inc"), - ("-Inon-existing-dir", "-Inon-existing-dir"), + ("-Inon-existing-dir", "non-existing-dir"), ( "-include $PROJECT_DIR/lib/component/component-forced-include.h", "component-forced-include.h", From 837ea85c3cfa74fbd04fb090cd1b30fc665c2fd2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 13:53:14 +0300 Subject: [PATCH 6/7] Resolved an issue that resulted in unresolved absolute toolchain paths when generating the "compile_commands.json" // Resolve #4684 --- HISTORY.rst | 1 + docs | 2 +- platformio/builder/main.py | 9 +-------- platformio/builder/tools/piobuild.py | 22 ++++++++++++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 63f54eec..5c8a5a88 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,6 +19,7 @@ PlatformIO Core 6 ~~~~~~~~~~~~~~~~~~ * Rectified a regression bug that occurred when the ``-include`` flag was passed via the `build_flags `__ option as a relative path and subsequently expanded (`issue #4683 `_) +* Resolved an issue that resulted in unresolved absolute toolchain paths when generating the `Compilation database "compile_commands.json" `__ (`issue #4684 `_) 6.1.8 (2023-07-05) ~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index 3f462c9a..f74e6ca2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3f462c9ae63623710d48c85e16241bbb0a2b6553 +Subproject commit f74e6ca2346e4523fc841d2871114c45e36f651d diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 3aa460cd..2ca41f38 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -30,7 +30,7 @@ from SCons.Script import Variables # pylint: disable=import-error from platformio import app, fs from platformio.platform.base import PlatformBase -from platformio.proc import get_pythonexe_path, where_is_program +from platformio.proc import get_pythonexe_path from platformio.project.helpers import get_project_dir AllowSubstExceptions(NameError) @@ -195,13 +195,6 @@ if env.get("SIZETOOL") and not ( Default("checkprogsize") if "compiledb" in COMMAND_LINE_TARGETS: - # Resolve absolute path of toolchain - for cmd in ("CC", "CXX", "AS"): - if cmd not in env: - continue - if os.path.isabs(env[cmd]): - continue - env[cmd] = where_is_program(env.subst("$%s" % cmd), env.subst("${ENV['PATH']}")) env.Alias("compiledb", env.CompilationDatabase("$COMPILATIONDB_PATH")) # Print configured protocols diff --git a/platformio/builder/tools/piobuild.py b/platformio/builder/tools/piobuild.py index 6fb2eb6f..74725a02 100644 --- a/platformio/builder/tools/piobuild.py +++ b/platformio/builder/tools/piobuild.py @@ -26,6 +26,7 @@ from SCons.Script import SConscript # pylint: disable=import-error from platformio import __version__, fs from platformio.compat import IS_MACOS, string_types from platformio.package.version import pepver_to_semver +from platformio.proc import where_is_program SRC_HEADER_EXT = ["h", "hpp"] SRC_ASM_EXT = ["S", "spp", "SPP", "sx", "s", "asm", "ASM"] @@ -125,12 +126,21 @@ def ProcessProgramDeps(env): # remove specified flags env.ProcessUnFlags(env.get("BUILD_UNFLAGS")) - if "compiledb" in COMMAND_LINE_TARGETS and env.get( - "COMPILATIONDB_INCLUDE_TOOLCHAIN" - ): - for scope, includes in env.DumpIntegrationIncludes().items(): - if scope in ("toolchain",): - env.Append(CPPPATH=includes) + if "compiledb" in COMMAND_LINE_TARGETS: + # Resolve absolute path of toolchain + for cmd in ("CC", "CXX", "AS"): + if cmd not in env: + continue + if os.path.isabs(env[cmd]): + continue + env[cmd] = where_is_program( + env.subst("$%s" % cmd), env.subst("${ENV['PATH']}") + ) + + if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"): + for scope, includes in env.DumpIntegrationIncludes().items(): + if scope in ("toolchain",): + env.Append(CPPPATH=includes) def ProcessProjectDeps(env): From 3d48f3ec04dc8a15d67503391c5fca543cf3ce2a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 14:33:15 +0300 Subject: [PATCH 7/7] Bump version to 6.1.9 --- HISTORY.rst | 2 +- docs | 2 +- platformio/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5c8a5a88..8ec95eb4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,7 +15,7 @@ PlatformIO Core 6 **A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** -6.1.9 (2023-??-??) +6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ * Rectified a regression bug that occurred when the ``-include`` flag was passed via the `build_flags `__ option as a relative path and subsequently expanded (`issue #4683 `_) diff --git a/docs b/docs index f74e6ca2..f8dbf012 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f74e6ca2346e4523fc841d2871114c45e36f651d +Subproject commit f8dbf012e4a7ddbe79279540e95c08a2d108c725 diff --git a/platformio/__init__.py b/platformio/__init__.py index 79281da5..c720d005 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "9rc1") +VERSION = (6, 1, 9) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"