Skip to content

Commit 8814f4e

Browse files
committed
Merge branch 'release/v6.1.4'
2 parents 8dc20f9 + 43dd429 commit 8814f4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+383
-374
lines changed

HISTORY.rst

+13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ PlatformIO Core 6
1313

1414
**A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.**
1515

16+
6.1.4 (2022-08-12)
17+
~~~~~~~~~~~~~~~~~~
18+
19+
* Added support for accepting the original FileNode environment in a "callback" function when using `Build Middlewares <https://docs.platformio.org/en/latest/scripting/middlewares.html>`__ (`pull #4380 <https://github.com/platformio/platformio-core/pull/4380>`_)
20+
* Improved device port finder when using dual channel UART converter (`issue #4367 <https://github.com/platformio/platformio-core/issues/4367>`_)
21+
* Improved project dependency resolving when using the `pio project init --ide <https://docs.platformio.org/en/latest/core/userguide/project/cmd_init.html>`__ command
22+
* Upgraded build engine to the SCons 4.4.0 (`release notes <https://github.com/SCons/scons/releases/tag/4.4.0>`__)
23+
* Keep custom "unwantedRecommendations" when generating projects for VSCode (`issue #4383 <https://github.com/platformio/platformio-core/issues/4383>`_)
24+
* Do not resolve project dependencies for the ``cleanall`` target (`issue #4344 <https://github.com/platformio/platformio-core/issues/4344>`_)
25+
* Warn about calling "env.BuildSources" in a POST-type script (`issue #4385 <https://github.com/platformio/platformio-core/issues/4385>`_)
26+
* Fixed an issue when escaping macros/defines for IDE integration (`issue #4360 <https://github.com/platformio/platformio-core/issues/4360>`_)
27+
* Fixed an issue when the "cleanall" target removes dependencies from all working environments (`issue #4386 <https://github.com/platformio/platformio-core/issues/4386>`_)
28+
1629
6.1.3 (2022-07-18)
1730
~~~~~~~~~~~~~~~~~~
1831

README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg
2-
:target: https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md
3-
:alt: SWUbanner
4-
51
PlatformIO Core
62
===============
73

@@ -99,3 +95,7 @@ Copyright (c) 2014-present PlatformIO <[email protected]>
9995

10096
The PlatformIO is licensed under the permissive Apache 2.0 license,
10197
so you can use it in both commercial and personal projects with confidence.
98+
99+
.. image:: https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg
100+
:target: https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md
101+
:alt: SWUbanner

docs

Submodule docs updated 151 files

examples

platformio/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import sys
1616

17-
VERSION = (6, 1, 3)
17+
VERSION = (6, 1, 4)
1818
__version__ = ".".join([str(s) for s in VERSION])
1919

2020
__title__ = "platformio"
@@ -49,7 +49,7 @@
4949
__core_packages__ = {
5050
"contrib-piohome": "~3.4.2",
5151
"contrib-pysite": "~2.%d%d.0" % (sys.version_info.major, sys.version_info.minor),
52-
"tool-scons": "~4.40300.0",
52+
"tool-scons": "~4.40400.0",
5353
"tool-cppcheck": "~1.270.0",
5454
"tool-clangtidy": "~1.120001.0",
5555
"tool-pvs-studio": "~7.18.0",

platformio/__main__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@click.option("--caller", "-c", help="Caller ID (service)")
3232
@click.option("--no-ansi", is_flag=True, help="Do not print ANSI control characters")
3333
@click.pass_context
34-
def cli(ctx, force, caller, no_ansi):
34+
def cli(ctx, force, caller, no_ansi): # pylint: disable=unused-argument
3535
try:
3636
if (
3737
no_ansi
@@ -53,7 +53,7 @@ def cli(ctx, force, caller, no_ansi):
5353
except: # pylint: disable=bare-except
5454
pass
5555

56-
maintenance.on_platformio_start(ctx, force, caller)
56+
maintenance.on_platformio_start(ctx, caller)
5757

5858

5959
@cli.result_callback()

platformio/app.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
16-
1715
import getpass
1816
import hashlib
1917
import json
@@ -64,7 +62,6 @@ def projects_dir_validate(projects_dir):
6462

6563
SESSION_VARS = {
6664
"command_ctx": None,
67-
"force_option": False,
6865
"caller_id": None,
6966
"custom_project_conf": None,
7067
}
@@ -229,13 +226,7 @@ def set_session_var(name, value):
229226

230227

231228
def is_disabled_progressbar():
232-
return any(
233-
[
234-
get_session_var("force_option"),
235-
proc.is_ci(),
236-
os.getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true",
237-
]
238-
)
229+
return os.getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true"
239230

240231

241232
def get_cid():

platformio/builder/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"link",
5656
"piohooks",
5757
"pioasm",
58-
"platformio",
58+
"piobuild",
5959
"pioproject",
6060
"pioplatform",
6161
"piotest",
@@ -82,7 +82,6 @@
8282
PROGPATH=os.path.join("$BUILD_DIR", "$PROGNAME$PROGSUFFIX"),
8383
PROG_PATH="$PROGPATH", # deprecated
8484
PYTHONEXE=get_pythonexe_path(),
85-
IDE_EXTRA_DATA={},
8685
)
8786

8887
# Declare command verbose messages
@@ -127,6 +126,7 @@
127126
PROJECT_DATA_DIR=config.get("platformio", "data_dir"),
128127
PROJECTDATA_DIR="$PROJECT_DATA_DIR", # legacy for dev/platform
129128
PROJECT_BUILD_DIR=config.get("platformio", "build_dir"),
129+
BUILD_TYPE=env.GetBuildType(),
130130
BUILD_CACHE_DIR=config.get("platformio", "build_cache_dir"),
131131
LIBSOURCE_DIRS=[
132132
config.get("platformio", "lib_dir"),

platformio/builder/tools/compilation_db.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@
2323
# pylint: disable=unused-argument, protected-access, unused-variable, import-error
2424
# Original: https://github.com/mongodb/mongo/blob/master/site_scons/site_tools/compilation_db.py
2525

26-
from __future__ import absolute_import
27-
2826
import itertools
2927
import json
3028
import os
3129

3230
import SCons
3331

34-
from platformio.builder.tools.platformio import SRC_ASM_EXT, SRC_C_EXT, SRC_CXX_EXT
32+
from platformio.builder.tools.piobuild import SRC_ASM_EXT, SRC_C_EXT, SRC_CXX_EXT
3533
from platformio.proc import where_is_program
3634

3735
# Implements the ability for SCons to emit a compilation database for the MongoDB project. See

platformio/builder/tools/pioasm.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
16-
1715
import SCons.Tool.asm # pylint: disable=import-error
1816

1917
#

platformio/builder/tools/platformio.py renamed to platformio/builder/tools/piobuild.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
16-
1715
import fnmatch
1816
import os
1917
import sys
@@ -86,7 +84,7 @@ def BuildProgram(env):
8684
)
8785
)
8886

89-
print("Building in %s mode" % env.GetBuildType())
87+
print("Building in %s mode" % env["BUILD_TYPE"])
9088

9189
return program
9290

@@ -121,7 +119,7 @@ def _append_pio_macros():
121119
# process framework scripts
122120
env.BuildFrameworks(env.get("PIOFRAMEWORK"))
123121

124-
if "debug" in env.GetBuildType():
122+
if "debug" in env["BUILD_TYPE"]:
125123
env.ConfigureDebugTarget()
126124

127125
# remove specified flags
@@ -149,7 +147,7 @@ def ProcessProjectDeps(env):
149147
}
150148
)
151149

152-
if "test" in env.GetBuildType():
150+
if "test" in env["BUILD_TYPE"]:
153151
build_files_before_nums = len(env.get("PIOBUILDFILES", []))
154152
plb.env.BuildSources(
155153
"$BUILD_TEST_DIR", "$PROJECT_TEST_DIR", "$PIOTEST_SRC_FILTER"
@@ -161,7 +159,7 @@ def ProcessProjectDeps(env):
161159
)
162160
env.Exit(1)
163161

164-
if "test" not in env.GetBuildType() or env.GetProjectOption("test_build_src"):
162+
if "test" not in env["BUILD_TYPE"] or env.GetProjectOption("test_build_src"):
165163
plb.env.BuildSources(
166164
"$BUILD_SRC_DIR", "$PROJECT_SRC_DIR", env.get("SRC_FILTER")
167165
)
@@ -294,7 +292,12 @@ def CollectBuildFiles(
294292
for callback, pattern in middlewares:
295293
if pattern and not fnmatch.fnmatch(node.srcnode().get_path(), pattern):
296294
continue
297-
new_node = callback(new_node)
295+
if callback.__code__.co_argcount == 2:
296+
new_node = callback(env, new_node)
297+
else:
298+
new_node = callback(new_node)
299+
if not new_node:
300+
break
298301
if new_node:
299302
new_sources.append(new_node)
300303

@@ -338,6 +341,14 @@ def BuildLibrary(env, variant_dir, src_dir, src_filter=None, nodes=None):
338341

339342

340343
def BuildSources(env, variant_dir, src_dir, src_filter=None):
344+
if env.get("PIOMAINPROG"):
345+
sys.stderr.write(
346+
"Error: The main program is already constructed and the inline "
347+
"source files are not allowed. Please use `env.BuildLibrary(...)` "
348+
"or PRE-type script instead."
349+
)
350+
env.Exit(1)
351+
341352
nodes = env.CollectBuildFiles(variant_dir, src_dir, src_filter)
342353
DefaultEnvironment().Append(
343354
PIOBUILDFILES=[

platformio/builder/tools/piohooks.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
16-
1715

1816
def AddActionWrapper(handler):
1917
def wraps(env, files, action):

platformio/builder/tools/pioino.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
16-
1715
import atexit
1816
import glob
1917
import io

platformio/builder/tools/piointegration.py

+29-40
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from __future__ import absolute_import
1615

1716
import glob
1817
import os
@@ -94,7 +93,7 @@ def dump_defines(env):
9493
for item in SCons.Defaults.processDefines(env.get("CPPDEFINES", [])):
9594
item = item.strip()
9695
if item:
97-
defines.append(env.subst(item).replace("\\", ""))
96+
defines.append(env.subst(item).replace('\\"', '"'))
9897

9998
# special symbol for Atmel AVR MCU
10099
if env["PIOPLATFORM"] == "atmelavr":
@@ -145,51 +144,39 @@ def _subst_cmd(env, cmd):
145144
return " ".join([SCons.Subst.quote_spaces(arg) for arg in args])
146145

147146

148-
def DumpIntegrationData(env, globalenv):
149-
"""env here is `projenv`"""
150-
147+
def DumpIntegrationData(*args):
148+
projenv, globalenv = args[0:2] # pylint: disable=unbalanced-tuple-unpacking
151149
data = {
152-
"env_name": env["PIOENV"],
153-
"libsource_dirs": [env.subst(item) for item in env.GetLibSourceDirs()],
154-
"defines": dump_defines(env),
155-
"includes": env.DumpIntegrationIncludes(),
156-
"cc_path": where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
157-
"cxx_path": where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")),
158-
"gdb_path": where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
159-
"prog_path": env.subst("$PROG_PATH"),
160-
"svd_path": dump_svd_path(env),
161-
"compiler_type": env.GetCompilerType(),
150+
"env_name": globalenv["PIOENV"],
151+
"libsource_dirs": [
152+
globalenv.subst(item) for item in globalenv.GetLibSourceDirs()
153+
],
154+
"defines": dump_defines(projenv),
155+
"includes": projenv.DumpIntegrationIncludes(),
156+
"cc_flags": _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS"),
157+
"cxx_flags": _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
158+
"cc_path": where_is_program(
159+
globalenv.subst("$CC"), globalenv.subst("${ENV['PATH']}")
160+
),
161+
"cxx_path": where_is_program(
162+
globalenv.subst("$CXX"), globalenv.subst("${ENV['PATH']}")
163+
),
164+
"gdb_path": where_is_program(
165+
globalenv.subst("$GDB"), globalenv.subst("${ENV['PATH']}")
166+
),
167+
"prog_path": globalenv.subst("$PROGPATH"),
168+
"svd_path": dump_svd_path(globalenv),
169+
"compiler_type": globalenv.GetCompilerType(),
162170
"targets": globalenv.DumpTargets(),
163171
"extra": dict(
164172
flash_images=[
165-
{"offset": item[0], "path": env.subst(item[1])}
166-
for item in env.get("FLASH_EXTRA_IMAGES", [])
173+
{"offset": item[0], "path": globalenv.subst(item[1])}
174+
for item in globalenv.get("FLASH_EXTRA_IMAGES", [])
167175
]
168176
),
169177
}
170-
data["extra"].update(
171-
env.get("INTEGRATION_EXTRA_DATA", env.get("IDE_EXTRA_DATA", {}))
172-
)
173-
174-
env_ = env.Clone()
175-
# https://github.com/platformio/platformio-atom-ide/issues/34
176-
_new_defines = []
177-
for item in SCons.Defaults.processDefines(env_.get("CPPDEFINES", [])):
178-
item = item.replace('\\"', '"')
179-
if " " in item:
180-
_new_defines.append(item.replace(" ", "\\\\ "))
181-
else:
182-
_new_defines.append(item)
183-
env_.Replace(CPPDEFINES=_new_defines)
184-
185-
# export C/C++ build flags
186-
data.update(
187-
{
188-
"cc_flags": _subst_cmd(env_, "$CFLAGS $CCFLAGS $CPPFLAGS"),
189-
"cxx_flags": _subst_cmd(env_, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
190-
}
191-
)
192-
178+
for key in ("IDE_EXTRA_DATA", "INTEGRATION_EXTRA_DATA"):
179+
data["extra"].update(globalenv.get(key, {}))
193180
return data
194181

195182

@@ -198,6 +185,8 @@ def exists(_):
198185

199186

200187
def generate(env):
188+
env["IDE_EXTRA_DATA"] = {} # legacy support
189+
env["INTEGRATION_EXTRA_DATA"] = {}
201190
env.AddMethod(IsIntegrationDump)
202191
env.AddMethod(DumpIntegrationIncludes)
203192
env.AddMethod(DumpIntegrationData)

0 commit comments

Comments
 (0)