Skip to content

Commit a76e445

Browse files
committed
Merge branch 'release/v6.0.1'
2 parents 44ecc7c + cb7148d commit a76e445

File tree

13 files changed

+116
-94
lines changed

13 files changed

+116
-94
lines changed

HISTORY.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Release Notes
33

44
.. |PIOCONF| replace:: `"platformio.ini" <https://docs.platformio.org/en/latest/projectconf.html>`__ configuration file
55
.. |LDF| replace:: `LDF <https://docs.platformio.org/en/latest/librarymanager/ldf.html>`__
6+
.. |INTERPOLATION| replace:: `Interpolation of Values <https://docs.platformio.org/en/latest/projectconf/interpolation.html>`__
67

78
.. _release_notes_6:
89

@@ -11,6 +12,13 @@ PlatformIO Core 6
1112

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

15+
6.0.1 (2022-05-17)
16+
~~~~~~~~~~~~~~~~~~
17+
18+
* Improved support for the renamed configuration options (`issue #4270 <https://github.com/platformio/platformio-core/issues/4270>`_)
19+
* Fixed an issue when calling the built-in `pio device monitor <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#filters>`__ filters
20+
* Fixed an issue when using |INTERPOLATION| and merging str+int options (`issue #4271 <https://github.com/platformio/platformio-core/issues/4271>`_)
21+
1422
6.0.0 (2022-05-16)
1523
~~~~~~~~~~~~~~~~~~
1624

@@ -92,7 +100,7 @@ Please check the `Migration guide from 5.x to 6.0 <https://docs.platformio.org/e
92100

93101
* **Project Configuration**
94102

95-
- Extended `Interpolation of Values <https://docs.platformio.org/en/latest/projectconf/interpolation.html>`__ with ``${this}`` pattern (`issue #3953 <https://github.com/platformio/platformio-core/issues/3953>`_)
103+
- Extended |INTERPOLATION| with ``${this}`` pattern (`issue #3953 <https://github.com/platformio/platformio-core/issues/3953>`_)
96104
- Embed environment name of the current section in the |PIOCONF| using ``${this.__env__}`` pattern
97105
- Renamed the "src_build_flags" project configuration option to the `build_src_flags <https://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-src-flags>`__
98106
- Renamed the "src_filter" project configuration option to the `build_src_filter <https://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-src-filter>`__

platformio/__init__.py

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

1515
import sys
1616

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

2020
__title__ = "platformio"

platformio/builder/tools/pioproject.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from __future__ import absolute_import
1616

1717
from platformio.compat import MISSING
18-
from platformio.project.config import ProjectConfig, ProjectOptions
18+
from platformio.project.config import ProjectConfig
1919

2020

2121
def GetProjectConfig(env):
@@ -31,15 +31,17 @@ def GetProjectOption(env, option, default=MISSING):
3131

3232

3333
def LoadProjectOptions(env):
34-
for option, value in env.GetProjectOptions():
35-
option_meta = ProjectOptions.get("env." + option)
34+
config = env.GetProjectConfig()
35+
section = "env:" + env["PIOENV"]
36+
for option in config.options(section):
37+
option_meta = config.find_option_meta(section, option)
3638
if (
3739
not option_meta
3840
or not option_meta.buildenvvar
3941
or option_meta.buildenvvar in env
4042
):
4143
continue
42-
env[option_meta.buildenvvar] = value
44+
env[option_meta.buildenvvar] = config.get(section, option)
4345

4446

4547
def exists(_):

platformio/commands/lib/command.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ def get_project_global_lib_dir():
6868
)
6969
@click.pass_context
7070
def cli(ctx, **options):
71+
in_silence = PlatformioCLI.in_silence()
72+
if not in_silence:
73+
click.secho(
74+
"\nWARNING!!! This command is deprecated and will be removed in "
75+
"the next releases. \nPlease use `pio pkg` instead.\n",
76+
fg="yellow",
77+
)
78+
7179
storage_cmds = ("install", "uninstall", "update", "list")
7280
# skip commands that don't need storage folder
7381
if ctx.invoked_subcommand not in storage_cmds or (
@@ -94,7 +102,6 @@ def cli(ctx, **options):
94102
get_project_dir(), get_project_global_lib_dir(), ctx.invoked_subcommand
95103
)
96104

97-
in_silence = PlatformioCLI.in_silence()
98105
ctx.meta[CTX_META_PROJECT_ENVIRONMENTS_KEY] = options["environment"]
99106
ctx.meta[CTX_META_INPUT_DIRS_KEY] = storage_dirs
100107
ctx.meta[CTX_META_STORAGE_DIRS_KEY] = []

platformio/commands/platform.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import click
2020

21+
from platformio.commands import PlatformioCLI
2122
from platformio.commands.boards import print_boards
2223
from platformio.exception import UserSideException
2324
from platformio.package.exception import UnknownPackageError
@@ -30,7 +31,12 @@
3031

3132
@click.group(short_help="Platform manager", hidden=True)
3233
def cli():
33-
pass
34+
if not PlatformioCLI.in_silence():
35+
click.secho(
36+
"\nWARNING!!! This command is deprecated and will be removed in "
37+
"the next releases. \nPlease use `pio pkg` instead.\n",
38+
fg="yellow",
39+
)
3440

3541

3642
@cli.command("search", short_help="Search for development platform")

platformio/commands/update.py

+6-26
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
import click
1616

17-
from platformio.commands.lib.command import CTX_META_STORAGE_DIRS_KEY
18-
from platformio.commands.lib.command import lib_update as cmd_lib_update
19-
from platformio.commands.platform import platform_update as cmd_platform_update
20-
from platformio.package.manager.core import update_core_packages
21-
from platformio.package.manager.library import LibraryPackageManager
22-
2317

2418
@click.command(
2519
"update",
@@ -36,23 +30,9 @@
3630
@click.option(
3731
"--dry-run", is_flag=True, help="Do not update, only check for the new versions"
3832
)
39-
@click.pass_context
40-
def cli(ctx, core_packages, only_check, dry_run):
41-
only_check = dry_run or only_check
42-
43-
if not only_check:
44-
update_core_packages()
45-
46-
if core_packages:
47-
return
48-
49-
click.echo()
50-
click.echo("Platform Manager")
51-
click.echo("================")
52-
ctx.invoke(cmd_platform_update, only_check=only_check)
53-
54-
click.echo()
55-
click.echo("Library Manager")
56-
click.echo("===============")
57-
ctx.meta[CTX_META_STORAGE_DIRS_KEY] = [LibraryPackageManager().package_dir]
58-
ctx.invoke(cmd_lib_update, only_check=only_check)
33+
def cli(*_, **__):
34+
click.secho(
35+
"This command is deprecated and will be removed in the next releases. \n"
36+
"Please use `pio pkg update` instead.",
37+
fg="yellow",
38+
)

platformio/device/filters/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def register_filters(platform=None, options=None):
7171
)
7272
# default filters
7373
load_monitor_filters(
74-
os.path.join(fs.get_source_dir(), "commands", "device", "filters"),
74+
os.path.join(fs.get_source_dir(), "device", "filters"),
7575
options=options,
7676
)
7777

platformio/project/config.py

+43-48
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class ProjectConfigBase(object):
4343
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
4444
VARTPL_RE = re.compile(r"\$\{([^\.\}\()]+)\.([^\}]+)\}")
4545

46+
CUSTOM_OPTION_PREFIXES = ("custom_", "board_")
47+
4648
expand_interpolations = True
4749
warnings = []
4850

@@ -109,23 +111,6 @@ def read(self, path, parse_extra=True):
109111
self.read(item)
110112

111113
def _maintain_renaimed_options(self):
112-
# legacy `lib_extra_dirs` in [platformio]
113-
if self._parser.has_section("platformio") and self._parser.has_option(
114-
"platformio", "lib_extra_dirs"
115-
):
116-
if not self._parser.has_section("env"):
117-
self._parser.add_section("env")
118-
self._parser.set(
119-
"env",
120-
"lib_extra_dirs",
121-
self._parser.get("platformio", "lib_extra_dirs"),
122-
)
123-
self._parser.remove_option("platformio", "lib_extra_dirs")
124-
self.warnings.append(
125-
"`lib_extra_dirs` configuration option is deprecated in "
126-
"section [platformio]! Please move it to global `env` section"
127-
)
128-
129114
renamed_options = {}
130115
for option in ProjectOptions.values():
131116
if option.oldnames:
@@ -143,19 +128,20 @@ def _maintain_renaimed_options(self):
143128
"Please use `%s` instead"
144129
% (option, section, renamed_options[option])
145130
)
146-
# rename on-the-fly
147-
self._parser.set(
148-
section,
149-
renamed_options[option],
150-
self._parser.get(section, option),
151-
)
152-
self._parser.remove_option(section, option)
131+
# # rename on-the-fly
132+
# self._parser.set(
133+
# section,
134+
# renamed_options[option],
135+
# self._parser.get(section, option),
136+
# )
137+
# self._parser.remove_option(section, option)
153138
continue
154139

155140
# unknown
156141
unknown_conditions = [
157142
("%s.%s" % (scope, option)) not in ProjectOptions,
158-
scope != "env" or not option.startswith(("custom_", "board_")),
143+
scope != "env"
144+
or not option.startswith(self.CUSTOM_OPTION_PREFIXES),
159145
]
160146
if all(unknown_conditions):
161147
self.warnings.append(
@@ -237,16 +223,7 @@ def set(self, section, option, value):
237223
value = "\n" + value
238224
self._parser.set(section, option, value)
239225

240-
def getraw(self, section, option, default=MISSING):
241-
try:
242-
return self._getraw(section, option, default)
243-
except configparser.NoOptionError as exc:
244-
renamed_option = self._resolve_renamed_option(section, option)
245-
if renamed_option:
246-
return self._getraw(section, renamed_option, default)
247-
raise exc
248-
249-
def _resolve_renamed_option(self, section, old_name):
226+
def resolve_renamed_option(self, section, old_name):
250227
scope = self.get_section_scope(section)
251228
if scope not in ("platformio", "env"):
252229
return None
@@ -259,19 +236,39 @@ def _resolve_renamed_option(self, section, old_name):
259236
return option_meta.name
260237
return None
261238

262-
def _getraw(self, section, option, default): # pylint: disable=too-many-branches
239+
def find_option_meta(self, section, option):
240+
scope = self.get_section_scope(section)
241+
if scope not in ("platformio", "env"):
242+
return None
243+
option_meta = ProjectOptions.get("%s.%s" % (scope, option))
244+
if option_meta:
245+
return option_meta
246+
for option_meta in ProjectOptions.values():
247+
if option_meta.scope == scope and option in (option_meta.oldnames or []):
248+
return option_meta
249+
return None
250+
251+
def _traverse_for_value(self, section, option, option_meta=None):
252+
for _section, _option in self.walk_options(section):
253+
if _option == option or (
254+
option_meta
255+
and (
256+
option_meta.name == _option
257+
or _option in (option_meta.oldnames or [])
258+
)
259+
):
260+
return self._parser.get(_section, _option)
261+
return MISSING
262+
263+
def getraw(
264+
self, section, option, default=MISSING
265+
): # pylint: disable=too-many-branches
263266
if not self.expand_interpolations:
264267
return self._parser.get(section, option)
265268

266-
value = MISSING
267-
for sec, opt in self.walk_options(section):
268-
if opt == option:
269-
value = self._parser.get(sec, option)
270-
break
269+
option_meta = self.find_option_meta(section, option)
270+
value = self._traverse_for_value(section, option, option_meta)
271271

272-
option_meta = ProjectOptions.get(
273-
"%s.%s" % (self.get_section_scope(section), option)
274-
)
275272
if not option_meta:
276273
if value == MISSING:
277274
value = (
@@ -333,7 +330,7 @@ def _re_interpolation_handler(self, parent_section, match):
333330
)
334331
if isinstance(value, list):
335332
return "\n".join(value)
336-
return value
333+
return str(value)
337334

338335
def get(self, section, option, default=MISSING):
339336
value = None
@@ -342,9 +339,7 @@ def get(self, section, option, default=MISSING):
342339
except configparser.Error as e:
343340
raise exception.InvalidProjectConfError(self.path, str(e))
344341

345-
option_meta = ProjectOptions.get(
346-
"%s.%s" % (self.get_section_scope(section), option)
347-
)
342+
option_meta = self.find_option_meta(section, option)
348343
if not option_meta:
349344
return value
350345

File renamed without changes.

platformio/telemetry.py

+1
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def dump_run_environment(options):
346346
"check_tool",
347347
"debug_tool",
348348
"monitor_filters",
349+
"test_framework",
349350
]
350351
safe_options = {k: v for k, v in options.items() if k in non_sensitive_data}
351352
if is_platformio_project(os.getcwd()):

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
minimal_requirements = [
3030
"bottle==0.12.*",
31-
"click%s" % (">=8.0.3,<9" if sys.version_info >= (3, 7) else "==8.0.4"),
31+
"click%s" % (">=8.0.4,<9" if sys.version_info >= (3, 7) else "==8.0.4"),
3232
"colorama",
33-
"marshmallow==3.*",
33+
"marshmallow==%s" % ("3.*" if sys.version_info >= (3, 7) else "3.14.1"),
3434
"pyelftools>=0.27,<1",
3535
"pyserial==3.*",
3636
"requests==2.*",

0 commit comments

Comments
 (0)