Skip to content

Commit

Permalink
Merge branch 'release/v5.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Nov 5, 2021
2 parents e964c7f + 133fa14 commit 326c249
Show file tree
Hide file tree
Showing 86 changed files with 562 additions and 432 deletions.
21 changes: 0 additions & 21 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
personal_token: ${{ secrets.DEPLOY_GH_DOCS_TOKEN }}
external_repository: ${{ env.DOCS_REPO }}
publish_dir: ./${{ env.DOCS_DIR }}
commit_message: Sync Docs
12 changes: 0 additions & 12 deletions .readthedocs.yml

This file was deleted.

115 changes: 65 additions & 50 deletions HISTORY.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs
Submodule docs updated 52 files
+6 −6 boards/espressif32/tinypico.rst
+10 −1 boards/index.rst
+136 −0 boards/nordicnrf52/adafruit_ledglasses_nrf52840.rst
+130 −0 boards/nordicnrf52/nicla_sense_me.rst
+4 −1 boards/siliconlabsefm32/tb_sense_12.rst
+137 −0 boards/ststm32/bw_swan_r5.rst
+132 −0 boards/ststm32/disco_b_u585i_iot02a.rst
+135 −0 boards/ststm32/disco_h735ig.rst
+3 −0 boards/ststm32/nucleo_f042k6.rst
+3 −0 boards/ststm32/nucleo_f446ze.rst
+137 −0 boards/ststm32/nucleo_g0b1re.rst
+134 −0 boards/ststm32/nucleo_l010rb.rst
+132 −0 boards/ststm32/nucleo_u575zi_q.rst
+3 −0 boards/ststm32/nucleo_wl55jc.rst
+142 −0 boards/ststm32/storm32_v1_31_rc.rst
+66 −13 core/userguide/device/cmd_monitor.rst
+5 −1 envvars.rst
+179 −21 frameworks/arduino.rst
+27 −0 frameworks/cmsis.rst
+6 −6 frameworks/espidf.rst
+27 −0 frameworks/libopencm3.rst
+1 −1 frameworks/logicromsdk.rst
+93 −0 frameworks/stm32cube.rst
+150 −0 frameworks/stm32cube_extra.rst
+52 −0 frameworks/zephyr.rst
+7 −7 platforms/atmelavr_extra.rst
+1 −1 platforms/atmelsam.rst
+3 −3 platforms/chipsalliance.rst
+7 −7 platforms/espressif32.rst
+1 −1 platforms/freescalekinetis.rst
+1 −1 platforms/nordicnrf51.rst
+23 −1 platforms/nordicnrf52.rst
+1 −1 platforms/nxpimxrt.rst
+1 −1 platforms/nxplpc.rst
+1 −1 platforms/sifive.rst
+1 −1 platforms/siliconlabsefm32.rst
+104 −1 platforms/ststm32.rst
+63 −0 plus/debug-tools/blackmagic.rst
+63 −0 plus/debug-tools/cmsis-dap.rst
+63 −0 plus/debug-tools/jlink.rst
+56 −0 plus/debug-tools/stlink.rst
+91 −0 plus/debugging.rst
+8 −13 projectconf/index.rst
+42 −19 projectconf/interpolation.rst
+1 −1 projectconf/section_env_advanced.rst
+1 −1 projectconf/section_env_build.rst
+10 −1 projectconf/section_env_debug.rst
+2 −2 projectconf/section_env_library.rst
+4 −4 projectconf/section_env_upload.rst
+22 −8 projectconf/section_platformio.rst
+76 −75 redirects.txt
+4 −4 tutorials/core/unit_testing_blink.rst
4 changes: 2 additions & 2 deletions platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

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

__title__ = "platformio"
Expand Down Expand Up @@ -47,7 +47,7 @@
__default_requests_timeout__ = (10, None) # (connect, read)

__core_packages__ = {
"contrib-piohome": "~3.3.4",
"contrib-piohome": "~3.4.0",
"contrib-pysite": "~2.%d%d.0" % (sys.version_info.major, sys.version_info.minor),
"tool-unity": "~1.20500.0",
"tool-scons": "~4.40200.0",
Expand Down
21 changes: 12 additions & 9 deletions platformio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
import platform
import socket
import uuid
from os.path import dirname, isdir, isfile, join, realpath

from platformio import __version__, exception, fs, proc
from platformio.compat import IS_WINDOWS, hashlib_encode_data
from platformio.package.lockfile import LockFile
from platformio.project.helpers import get_default_projects_dir, get_project_core_dir
from platformio.project.config import ProjectConfig
from platformio.project.helpers import get_default_projects_dir


def projects_dir_validate(projects_dir):
assert isdir(projects_dir)
return realpath(projects_dir)
assert os.path.isdir(projects_dir)
return os.path.realpath(projects_dir)


DEFAULT_SETTINGS = {
Expand Down Expand Up @@ -64,7 +64,7 @@ def projects_dir_validate(projects_dir):
"value": True,
},
"enable_telemetry": {
"description": ("Telemetry service <http://bit.ly/pio-telemetry> (Yes/No)"),
"description": ("Telemetry service <https://bit.ly/pio-telemetry> (Yes/No)"),
"value": True,
},
"force_verbose": {
Expand All @@ -91,15 +91,18 @@ def __init__(self, path=None, lock=False):
self.path = path
self.lock = lock
if not self.path:
self.path = join(get_project_core_dir(), "appstate.json")
core_dir = ProjectConfig.get_instance().get("platformio", "core_dir")
if not os.path.isdir(core_dir):
os.makedirs(core_dir)
self.path = os.path.join(core_dir, "appstate.json")
self._storage = {}
self._lockfile = None
self.modified = False

def __enter__(self):
try:
self._lock_state_file()
if isfile(self.path):
if os.path.isfile(self.path):
self._storage = fs.load_json(self.path)
assert isinstance(self._storage, dict)
except (
Expand All @@ -117,7 +120,7 @@ def __exit__(self, type_, value, traceback):
with open(self.path, mode="w", encoding="utf8") as fp:
fp.write(json.dumps(self._storage))
except IOError:
raise exception.HomeDirPermissionsError(get_project_core_dir())
raise exception.HomeDirPermissionsError(os.path.dirname(self.path))
self._unlock_state_file()

def _lock_state_file(self):
Expand All @@ -127,7 +130,7 @@ def _lock_state_file(self):
try:
self._lockfile.acquire()
except IOError:
raise exception.HomeDirPermissionsError(dirname(self.path))
raise exception.HomeDirPermissionsError(os.path.dirname(self.path))

def _unlock_state_file(self):
if hasattr(self, "_lockfile") and self._lockfile:
Expand Down
28 changes: 14 additions & 14 deletions platformio/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,22 @@
config = env.GetProjectConfig()
env.Replace(
PROJECT_DIR=get_project_dir(),
PROJECT_CORE_DIR=config.get_optional_dir("core"),
PROJECT_PACKAGES_DIR=config.get_optional_dir("packages"),
PROJECT_WORKSPACE_DIR=config.get_optional_dir("workspace"),
PROJECT_LIBDEPS_DIR=config.get_optional_dir("libdeps"),
PROJECT_INCLUDE_DIR=config.get_optional_dir("include"),
PROJECT_SRC_DIR=config.get_optional_dir("src"),
PROJECTSRC_DIR=config.get_optional_dir("src"), # legacy for dev/platform
PROJECT_TEST_DIR=config.get_optional_dir("test"),
PROJECT_DATA_DIR=config.get_optional_dir("data"),
PROJECTDATA_DIR=config.get_optional_dir("data"), # legacy for dev/platform
PROJECT_BUILD_DIR=config.get_optional_dir("build"),
BUILD_CACHE_DIR=config.get_optional_dir("build_cache"),
PROJECT_CORE_DIR=config.get("platformio", "core_dir"),
PROJECT_PACKAGES_DIR=config.get("platformio", "packages_dir"),
PROJECT_WORKSPACE_DIR=config.get("platformio", "workspace_dir"),
PROJECT_LIBDEPS_DIR=config.get("platformio", "libdeps_dir"),
PROJECT_INCLUDE_DIR=config.get("platformio", "include_dir"),
PROJECT_SRC_DIR=config.get("platformio", "src_dir"),
PROJECTSRC_DIR=config.get("platformio", "src_dir"), # legacy for dev/platform
PROJECT_TEST_DIR=config.get("platformio", "test_dir"),
PROJECT_DATA_DIR=config.get("platformio", "data_dir"),
PROJECTDATA_DIR=config.get("platformio", "data_dir"), # legacy for dev/platform
PROJECT_BUILD_DIR=config.get("platformio", "build_dir"),
BUILD_CACHE_DIR=config.get("platformio", "build_cache_dir"),
LIBSOURCE_DIRS=[
config.get_optional_dir("lib"),
config.get("platformio", "lib_dir"),
os.path.join("$PROJECT_LIBDEPS_DIR", "$PIOENV"),
config.get_optional_dir("globallib"),
config.get("platformio", "globallib_dir"),
],
)

Expand Down
2 changes: 1 addition & 1 deletion platformio/builder/tools/pioide.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _dump_includes(env):
# include Unity framework if there are tests in project
includes["unity"] = []
auto_install_unity = False
test_dir = env.GetProjectConfig().get_optional_dir("test")
test_dir = env.GetProjectConfig().get("platformio", "test_dir")
if os.path.isdir(test_dir) and os.listdir(test_dir) != ["README"]:
auto_install_unity = True
unity_dir = get_core_package_dir(
Expand Down
2 changes: 1 addition & 1 deletion platformio/builder/tools/piolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ def _print_deps_tree(root, level=0):
project = ProjectAsLibBuilder(env, "$PROJECT_DIR")
ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project) # pylint: disable=no-member

click.echo("LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf")
click.echo("LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf")
click.echo(
"LDF Modes: Finder ~ %s, Compatibility ~ %s"
% (ldf_mode, project.lib_compat_mode)
Expand Down
4 changes: 2 additions & 2 deletions platformio/commands/check/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def cli(
)

default_patterns = [
config.get_optional_dir("src"),
config.get_optional_dir("include"),
config.get("platformio", "src_dir"),
config.get("platformio", "include_dir"),
]
tool_options = dict(
verbose=verbose,
Expand Down
2 changes: 1 addition & 1 deletion platformio/commands/check/tools/clangtidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def configure_command(self):
includes = []
for inc in self.cpp_includes:
if self.options.get("skip_packages") and inc.lower().startswith(
self.config.get_optional_dir("packages").lower()
self.config.get("platformio", "packages_dir").lower()
):
continue
includes.append(inc)
Expand Down
4 changes: 2 additions & 2 deletions platformio/commands/check/tools/cppcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def parse_defect(self, raw_line):
if (
args.get("file", "")
.lower()
.startswith(self.config.get_optional_dir("packages").lower())
.startswith(self.config.get("platformio", "packages_dir").lower())
):
if args["id"] in breaking_defect_ids:
if self.options.get("verbose"):
Expand Down Expand Up @@ -201,7 +201,7 @@ def _generate_inc_file(self):
result = []
for inc in self.cpp_includes:
if self.options.get("skip_packages") and inc.lower().startswith(
self.config.get_optional_dir("packages").lower()
self.config.get("platformio", "packages_dir").lower()
):
continue
result.append(inc)
Expand Down
2 changes: 1 addition & 1 deletion platformio/commands/check/tools/pvsstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, *args, **kwargs):
with open(self._tmp_cfg_file, mode="w", encoding="utf8") as fp:
fp.write(
"exclude-path = "
+ self.config.get_optional_dir("packages").replace("\\", "/")
+ self.config.get("platformio", "packages_dir").replace("\\", "/")
)

with open(self._tmp_cmd_file, mode="w", encoding="utf8") as fp:
Expand Down
25 changes: 9 additions & 16 deletions platformio/commands/device/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,21 @@ def device_list( # pylint: disable=too-many-branches
help="Load configuration from `platformio.ini` and specified environment",
)
def device_monitor(**kwargs): # pylint: disable=too-many-branches
# load default monitor filters
filters_dir = os.path.join(fs.get_source_dir(), "commands", "device", "filters")
for name in os.listdir(filters_dir):
if not name.endswith(".py"):
continue
device_helpers.load_monitor_filter(
os.path.join(filters_dir, name), options=kwargs
)

project_options = {}
platform = None
try:
with fs.cd(kwargs["project_dir"]):
project_options = device_helpers.get_project_options(kwargs["environment"])
kwargs = device_helpers.apply_project_monitor_options(kwargs, project_options)
kwargs = device_helpers.apply_project_monitor_options(
kwargs, project_options
)
if "platform" in project_options:
platform = PlatformFactory.new(project_options["platform"])
except NotPlatformIOProjectError:
pass

platform = None
if "platform" in project_options:
with fs.cd(kwargs["project_dir"]):
platform = PlatformFactory.new(project_options["platform"])
device_helpers.register_platform_filters(platform, options=kwargs)
with fs.cd(kwargs["project_dir"]):
device_helpers.register_filters(platform=platform, options=kwargs)

if not kwargs["port"]:
ports = util.get_serial_ports(filter_hwid=True)
Expand Down Expand Up @@ -231,7 +224,7 @@ def device_monitor(**kwargs): # pylint: disable=too-many-branches
"--- Available filters and text transformations: %s"
% ", ".join(sorted(miniterm.TRANSFORMATIONS.keys()))
)
click.echo("--- More details at http://bit.ly/pio-monitor-filters")
click.echo("--- More details at https://bit.ly/pio-monitor-filters")
try:
miniterm.main(
default_port=kwargs["port"],
Expand Down
34 changes: 30 additions & 4 deletions platformio/commands/device/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from platformio import fs
from platformio.commands.device import DeviceMonitorFilter
from platformio.compat import get_object_members, load_python_module
from platformio.package.manager.tool import ToolPackageManager
from platformio.project.config import ProjectConfig


Expand Down Expand Up @@ -92,15 +93,40 @@ def load_monitor_filter(path, options=None):
return True


def register_platform_filters(platform, options=None):
monitor_dir = os.path.join(platform.get_dir(), "monitor")
def load_monitor_filters(monitor_dir, prefix=None, options=None):
if not os.path.isdir(monitor_dir):
return

for name in os.listdir(monitor_dir):
if not name.startswith("filter_") or not name.endswith(".py"):
if (prefix and not name.startswith(prefix)) or not name.endswith(".py"):
continue
path = os.path.join(monitor_dir, name)
if not os.path.isfile(path):
continue
load_monitor_filter(path, options)


def register_filters(platform=None, options=None):
# project filters
load_monitor_filters(
ProjectConfig.get_instance().get("platformio", "monitor_dir"),
prefix="filter_",
options=options,
)
# platform filters
if platform:
load_monitor_filters(
os.path.join(platform.get_dir(), "monitor"),
prefix="filter_",
options=options,
)
# load package filters
pm = ToolPackageManager()
for pkg in pm.get_installed():
load_monitor_filters(
os.path.join(pkg.path, "monitor"), prefix="filter_", options=options
)
# default filters
load_monitor_filters(
os.path.join(fs.get_source_dir(), "commands", "device", "filters"),
options=options,
)
Loading

0 comments on commit 326c249

Please sign in to comment.