Skip to content

Commit 2f73629

Browse files
committed
Merge branch 'release/v6.1.1'
2 parents abb4647 + f453519 commit 2f73629

File tree

14 files changed

+191
-78
lines changed

14 files changed

+191
-78
lines changed

.github/workflows/deployment.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- "release/**"
7-
tags:
8-
- v*
97

108
jobs:
119
deployment:
@@ -35,8 +33,11 @@ jobs:
3533
run: |
3634
tox -e testcore
3735
36+
- name: Build Python source tarball
37+
run: python setup.py sdist
38+
3839
- name: Publish package to PyPI
39-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
40+
if: ${{ github.ref == 'refs/heads/master' }}
4041
uses: pypa/gh-action-pypi-publish@release/v1
4142
with:
4243
user: __token__

HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ PlatformIO Core 6
1313

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

16+
6.1.1 (2022-07-11)
17+
~~~~~~~~~~~~~~~~~~
18+
19+
* Added new ``monitor_encoding`` project configuration option to configure `Device Monitor <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html>`__ (`issue #4350 <https://github.com/platformio/platformio-core/issues/4350>`_)
20+
* Allowed specifying project environments for `pio ci <https://docs.platformio.org/en/latest/core/userguide/cmd_ci.html>`__ command (`issue #4347 <https://github.com/platformio/platformio-core/issues/4347>`_)
21+
* Show "TimeoutError" only in the verbose mode when can not find a serial port
22+
* Fixed an issue when a serial port was not automatically detected if the board has predefined HWIDs
23+
* Fixed an issue with endless scanning of project dependencies (`issue #4349 <https://github.com/platformio/platformio-core/issues/4349>`_)
24+
* Fixed an issue with |LDF| when incompatible libraries were used for the working project environment with the missed framework (`pull #4346 <https://github.com/platformio/platformio-core/pull/4346>`_)
25+
1626
6.1.0 (2022-07-06)
1727
~~~~~~~~~~~~~~~~~~
1828

platformio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import sys
1616

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

2020
__title__ = "platformio"

platformio/builder/tools/piolib.py

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from platformio import exception, fs
3232
from platformio.builder.tools import platformio as piotool
33-
from platformio.compat import IS_WINDOWS, hashlib_encode_data, string_types
33+
from platformio.compat import IS_WINDOWS, MISSING, hashlib_encode_data, string_types
3434
from platformio.http import HTTPClientError, InternetIsOffline
3535
from platformio.package.exception import (
3636
MissingPackageManifestError,
@@ -143,7 +143,7 @@ def __init__(self, env, path, manifest=None, verbose=False):
143143

144144
self._deps_are_processed = False
145145
self._circular_deps = []
146-
self._processed_files = []
146+
self._processed_search_files = []
147147

148148
# reset source filter, could be overridden with extra script
149149
self.env["SRC_FILTER"] = ""
@@ -154,20 +154,27 @@ def __init__(self, env, path, manifest=None, verbose=False):
154154
def __repr__(self):
155155
return "%s(%r)" % (self.__class__, self.path)
156156

157-
def __contains__(self, path):
158-
p1 = self.path
159-
p2 = path
157+
def __contains__(self, child_path):
158+
return self.is_common_builder(self.path, child_path)
159+
160+
def is_common_builder(self, root_path, child_path):
160161
if IS_WINDOWS:
161-
p1 = p1.lower()
162-
p2 = p2.lower()
163-
if p1 == p2:
162+
root_path = root_path.lower()
163+
child_path = child_path.lower()
164+
if root_path == child_path:
164165
return True
165-
if os.path.commonprefix([p1 + os.path.sep, p2]) == p1 + os.path.sep:
166+
if (
167+
os.path.commonprefix([root_path + os.path.sep, child_path])
168+
== root_path + os.path.sep
169+
):
166170
return True
167171
# try to resolve paths
168-
p1 = os.path.os.path.realpath(p1)
169-
p2 = os.path.os.path.realpath(p2)
170-
return os.path.commonprefix([p1 + os.path.sep, p2]) == p1 + os.path.sep
172+
root_path = os.path.realpath(root_path)
173+
child_path = os.path.realpath(child_path)
174+
return (
175+
os.path.commonprefix([root_path + os.path.sep, child_path])
176+
== root_path + os.path.sep
177+
)
171178

172179
@property
173180
def name(self):
@@ -324,7 +331,7 @@ def get_search_files(self):
324331
)
325332
]
326333

327-
def _get_found_includes( # pylint: disable=too-many-branches
334+
def get_implicit_includes( # pylint: disable=too-many-branches
328335
self, search_files=None
329336
):
330337
# all include directories
@@ -345,15 +352,17 @@ def _get_found_includes( # pylint: disable=too-many-branches
345352
include_dirs.extend(LibBuilderBase._INCLUDE_DIRS_CACHE)
346353

347354
result = []
348-
for path in search_files or []:
349-
if path in self._processed_files:
355+
search_files = search_files or []
356+
while search_files:
357+
node = self.env.File(search_files.pop(0))
358+
if node.get_abspath() in self._processed_search_files:
350359
continue
351-
self._processed_files.append(path)
360+
self._processed_search_files.append(node.get_abspath())
352361

353362
try:
354363
assert "+" in self.lib_ldf_mode
355364
candidates = LibBuilderBase.CCONDITIONAL_SCANNER(
356-
self.env.File(path),
365+
node,
357366
self.env,
358367
tuple(include_dirs),
359368
depth=self.CCONDITIONAL_SCANNER_DEPTH,
@@ -363,39 +372,35 @@ def _get_found_includes( # pylint: disable=too-many-branches
363372
if self.verbose and "+" in self.lib_ldf_mode:
364373
sys.stderr.write(
365374
"Warning! Classic Pre Processor is used for `%s`, "
366-
"advanced has failed with `%s`\n" % (path, exc)
375+
"advanced has failed with `%s`\n" % (node.get_abspath(), exc)
367376
)
368-
candidates = self.env.File(path).get_implicit_deps(
369-
self.env,
370-
LibBuilderBase.CLASSIC_SCANNER,
371-
lambda _: tuple(include_dirs),
377+
candidates = LibBuilderBase.CLASSIC_SCANNER(
378+
node, self.env, tuple(include_dirs)
372379
)
373380

374-
# mark candidates already processed
375-
self._processed_files.extend(
376-
[
377-
c.get_abspath()
378-
for c in candidates
379-
if c.get_abspath() not in self._processed_files
380-
]
381-
)
382-
383-
# print(path, [c.get_abspath() for c in candidates])
381+
# print(node.get_abspath(), [c.get_abspath() for c in candidates])
384382
for item in candidates:
383+
item_path = item.get_abspath()
384+
# process internal files recursively
385+
if (
386+
item_path not in self._processed_search_files
387+
and item_path not in search_files
388+
and item_path in self
389+
):
390+
search_files.append(item_path)
385391
if item not in result:
386392
result.append(item)
387393
if not self.PARSE_SRC_BY_H_NAME:
388394
continue
389-
_h_path = item.get_abspath()
390-
if not fs.path_endswith_ext(_h_path, piotool.SRC_HEADER_EXT):
395+
if not fs.path_endswith_ext(item_path, piotool.SRC_HEADER_EXT):
391396
continue
392-
_f_part = _h_path[: _h_path.rindex(".")]
397+
item_fname = item_path[: item_path.rindex(".")]
393398
for ext in piotool.SRC_C_EXT + piotool.SRC_CXX_EXT:
394-
if not os.path.isfile("%s.%s" % (_f_part, ext)):
399+
if not os.path.isfile("%s.%s" % (item_fname, ext)):
395400
continue
396-
_c_path = self.env.File("%s.%s" % (_f_part, ext))
397-
if _c_path not in result:
398-
result.append(_c_path)
401+
item_c_node = self.env.File("%s.%s" % (item_fname, ext))
402+
if item_c_node not in result:
403+
result.append(item_c_node)
399404

400405
return result
401406

@@ -410,7 +415,7 @@ def search_deps_recursive(self, search_files=None):
410415
search_files = self.get_search_files()
411416

412417
lib_inc_map = {}
413-
for inc in self._get_found_includes(search_files):
418+
for inc in self.get_implicit_includes(search_files):
414419
inc_path = inc.get_abspath()
415420
for lb in self.env.GetLibBuilders():
416421
if inc_path in lb:
@@ -571,11 +576,10 @@ def lib_ldf_mode(self):
571576
# pylint: disable=no-member
572577
if not self._manifest.get("dependencies"):
573578
return LibBuilderBase.lib_ldf_mode.fget(self)
574-
missing = object()
575579
global_value = self.env.GetProjectConfig().getraw(
576-
"env:" + self.env["PIOENV"], "lib_ldf_mode", missing
580+
"env:" + self.env["PIOENV"], "lib_ldf_mode", MISSING
577581
)
578-
if global_value != missing:
582+
if global_value != MISSING:
579583
return LibBuilderBase.lib_ldf_mode.fget(self)
580584
# automatically enable C++ Preprocessing in runtime
581585
# (Arduino IDE has this behavior)
@@ -827,11 +831,10 @@ def extra_script(self):
827831

828832
@property
829833
def lib_archive(self):
830-
missing = object()
831834
global_value = self.env.GetProjectConfig().getraw(
832-
"env:" + self.env["PIOENV"], "lib_archive", missing
835+
"env:" + self.env["PIOENV"], "lib_archive", MISSING
833836
)
834-
if global_value != missing:
837+
if global_value != MISSING:
835838
return self.env.GetProjectConfig().get(
836839
"env:" + self.env["PIOENV"], "lib_archive"
837840
)
@@ -881,6 +884,12 @@ def __init__(self, env, *args, **kwargs):
881884
if export_projenv:
882885
env.Export(dict(projenv=self.env))
883886

887+
def __contains__(self, child_path):
888+
for root_path in (self.include_dir, self.src_dir, self.test_dir):
889+
if root_path and self.is_common_builder(root_path, child_path):
890+
return True
891+
return False
892+
884893
@property
885894
def include_dir(self):
886895
include_dir = self.env.subst("$PROJECT_INCLUDE_DIR")
@@ -890,6 +899,10 @@ def include_dir(self):
890899
def src_dir(self):
891900
return self.env.subst("$PROJECT_SRC_DIR")
892901

902+
@property
903+
def test_dir(self):
904+
return self.env.subst("$PROJECT_TEST_DIR")
905+
893906
def get_search_files(self):
894907
items = []
895908
build_type = self.env.GetBuildType()
@@ -1035,7 +1048,7 @@ def IsCompatibleLibBuilder(env, lb, verbose=int(ARGUMENTS.get("PIOVERBOSE", 0)))
10351048
sys.stderr.write("Platform incompatible library %s\n" % lb.path)
10361049
return False
10371050
if compat_mode in ("soft", "strict") and not lb.is_frameworks_compatible(
1038-
env.get("PIOFRAMEWORK", [])
1051+
env.get("PIOFRAMEWORK", "__noframework__")
10391052
):
10401053
if verbose:
10411054
sys.stderr.write("Framework incompatible library %s\n" % lb.path)

platformio/builder/tools/pioupload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def AutodetectUploadPort(*args, **kwargs):
117117
board_config=env.BoardConfig() if "BOARD" in env else None,
118118
upload_protocol=upload_protocol,
119119
prefer_gdb_port="blackmagic" in upload_protocol,
120+
verbose=int(ARGUMENTS.get("PIOVERBOSE", 0)),
120121
)
121122
)
122123

platformio/commands/ci.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
6262
),
6363
)
6464
@click.option("-O", "--project-option", multiple=True)
65+
@click.option("-e", "--environment", "environments", multiple=True)
6566
@click.option("-v", "--verbose", is_flag=True)
6667
@click.pass_context
6768
def cli( # pylint: disable=too-many-arguments, too-many-branches
@@ -74,9 +75,9 @@ def cli( # pylint: disable=too-many-arguments, too-many-branches
7475
keep_build_dir,
7576
project_conf,
7677
project_option,
78+
environments,
7779
verbose,
7880
):
79-
8081
if not src and os.getenv("PLATFORMIO_CI_SRC"):
8182
src = validate_path(ctx, None, os.getenv("PLATFORMIO_CI_SRC").split(":"))
8283
if not src:
@@ -115,7 +116,9 @@ def cli( # pylint: disable=too-many-arguments, too-many-branches
115116
)
116117

117118
# process project
118-
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
119+
ctx.invoke(
120+
cmd_run, project_dir=build_dir, environment=environments, verbose=verbose
121+
)
119122
finally:
120123
if not keep_build_dir:
121124
fs.rmtree(build_dir)

platformio/debug/config/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import os
1717

1818
from platformio import fs, proc, util
19-
from platformio.compat import string_types
19+
from platformio.compat import MISSING, string_types
2020
from platformio.debug.exception import DebugInvalidOptionsError
2121
from platformio.project.config import ProjectConfig
2222
from platformio.project.helpers import load_build_metadata
@@ -96,9 +96,8 @@ def load_mode(self):
9696

9797
@property
9898
def init_break(self):
99-
missed = object()
100-
result = self.env_options.get("debug_init_break", missed)
101-
if result != missed:
99+
result = self.env_options.get("debug_init_break", MISSING)
100+
if result != MISSING:
102101
return result
103102
result = None
104103
if not result:

0 commit comments

Comments
 (0)