Skip to content

Commit

Permalink
Merge branch 'release/v5.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Oct 20, 2021
2 parents a7c82ff + 2e2773f commit e964c7f
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 12 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
exclude:
- os: macos-latest
python-version: "3.6"
- os: windows-latest
python-version: "3.10"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ PlatformIO Core 5

**A professional collaborative platform for embedded development**

5.2.2 (2021-10-20)
~~~~~~~~~~~~~~~~~~

- Override debugging firmware loading mode using ``--load-mode`` option for `pio debug <https://docs.platformio.org/en/latest/core/userguide/cmd_debug.html>`__ command
- Added support for CLion IDE 2021.3 (`pull #4085 <https://github.com/platformio/platformio-core/issues/4085>`_)
- Removed debugging "legacy Click" message from CLI (`issue #4083 <https://github.com/platformio/platformio-core/issues/4083>`_)
- Fixed a "TypeError: sequence item 1: expected str instance, list found" issue when extending configuration option in `"platformio.ini" <https://docs.platformio.org/page/projectconf.html>`__ with the multi-line default value (`issue #4082 <https://github.com/platformio/platformio-core/issues/4082>`_)

5.2.1 (2021-10-11)
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs
2 changes: 1 addition & 1 deletion platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

VERSION = (5, 2, 1)
VERSION = (5, 2, 2)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand Down
1 change: 0 additions & 1 deletion platformio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def process_result(ctx, result, *_, **__):


except (AttributeError, TypeError): # legacy support for CLick > 8.0.1
print("legacy Click")

@cli.resultcallback()
@click.pass_context
Expand Down
17 changes: 15 additions & 2 deletions platformio/commands/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import asyncio
import os
import signal
import subprocess

import click
Expand All @@ -31,6 +32,7 @@
from platformio.project.config import ProjectConfig
from platformio.project.exception import ProjectEnvsNotAvailableError
from platformio.project.helpers import is_platformio_project
from platformio.project.options import ProjectOptions


@click.command(
Expand All @@ -54,11 +56,21 @@
),
)
@click.option("--environment", "-e", metavar="<environment>")
@click.option("--load-mode", type=ProjectOptions["env.debug_load_mode"].type)
@click.option("--verbose", "-v", is_flag=True)
@click.option("--interface", type=click.Choice(["gdb"]))
@click.argument("__unprocessed", nargs=-1, type=click.UNPROCESSED)
@click.pass_context
def cli(ctx, project_dir, project_conf, environment, verbose, interface, __unprocessed):
def cli(
ctx,
project_dir,
project_conf,
environment,
load_mode,
verbose,
interface,
__unprocessed,
):
app.set_session_var("custom_project_conf", project_conf)

# use env variables from Eclipse or CLion
Expand Down Expand Up @@ -104,7 +116,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface, __unpro

rebuild_prog = False
preload = debug_config.load_cmds == ["preload"]
load_mode = debug_config.load_mode
load_mode = load_mode or debug_config.load_mode
if load_mode == "always":
rebuild_prog = preload or not helpers.has_debug_symbols(
debug_config.program_path
Expand Down Expand Up @@ -155,6 +167,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface, __unpro
client = GDBClientProcess(project_dir, debug_config)
coro = client.run(__unprocessed)
try:
signal.signal(signal.SIGINT, signal.SIG_IGN)
loop.run_until_complete(coro)
if IS_WINDOWS:
# an issue with `asyncio` executor and STIDIN,
Expand Down
4 changes: 2 additions & 2 deletions platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ set(CMAKE_CXX_STANDARD {{ cxx_stds[-1] }})

if (CMAKE_BUILD_TYPE MATCHES "{{ env_name }}")
% for define in defines:
add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
add_definitions(-D{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}})
% end

% for include in filter_includes(includes):
Expand All @@ -99,7 +99,7 @@ endif()
% for env, data in ide_data.items():
if (CMAKE_BUILD_TYPE MATCHES "{{ env }}")
% for define in data["defines"]:
add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
add_definitions(-D{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}})
% end

% for include in filter_includes(data["includes"]):
Expand Down
5 changes: 4 additions & 1 deletion platformio/ide/tpls/vscode/.vscode/launch.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
% "type": "PlatformIO",
% "task": ("Pre-Debug (%s)" % env_name) if len(config.envs()) > 1 else "Pre-Debug",
% }
% return [debug, predebug]
% noloading = predebug.copy()
% noloading["name"] = "PIO Debug (without uploading)"
% noloading["loadMode"] = "manual"
% return [debug, predebug, noloading]
% end
%
% def _remove_comments(lines):
Expand Down
5 changes: 4 additions & 1 deletion platformio/project/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ def _re_interpolation_handler(self, match):
section, option = match.group(1), match.group(2)
if section == "sysenv":
return os.getenv(option)
return self.getraw(section, option)
value = self.getraw(section, option)
if isinstance(value, list):
return "\n".join(value)
return value

def get(self, section, option, default=MISSING):
value = None
Expand Down
30 changes: 29 additions & 1 deletion tests/test_projectconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
[env:test_extends]
extends = strict_settings
[env:inject_base_env]
debug_build_flags =
${env.debug_build_flags}
-D CUSTOM_DEBUG_FLAG
"""

Expand Down Expand Up @@ -150,13 +154,20 @@ def test_sections(config):
"custom",
"env:base",
"env:test_extends",
"env:inject_base_env",
"env:extra_1",
"env:extra_2",
]


def test_envs(config):
assert config.envs() == ["base", "test_extends", "extra_1", "extra_2"]
assert config.envs() == [
"base",
"test_extends",
"inject_base_env",
"extra_1",
"extra_2",
]
assert config.default_envs() == ["base", "extra_2"]


Expand Down Expand Up @@ -274,6 +285,14 @@ def test_get_value(config):
assert config.get("env:extra_2", "monitor_speed") == 9600
assert config.get("env:base", "build_flags") == ["-D DEBUG=1"]

# get default value from ConfigOption
assert config.get("env:inject_base_env", "debug_build_flags") == [
"-Og",
"-g2",
"-ggdb2",
"-D CUSTOM_DEBUG_FLAG",
]


def test_items(config):
assert config.items("custom") == [
Expand Down Expand Up @@ -445,4 +464,13 @@ def test_dump(tmpdir_factory):
],
),
("env:test_extends", [("extends", ["strict_settings"])]),
(
"env:inject_base_env",
[
(
"debug_build_flags",
["${env.debug_build_flags}", "-D CUSTOM_DEBUG_FLAG"],
)
],
),
]

0 comments on commit e964c7f

Please sign in to comment.