From 646aa4f45b9ed0da36507437280516b87411f26d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 6 Jul 2023 14:44:56 +0300 Subject: [PATCH 01/34] Bump version to 6.1.10a1 --- HISTORY.rst | 3 +++ platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8ec95eb477..aa87ed80e5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,9 @@ PlatformIO Core 6 **A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** +6.1.10 (2023-??-??) +~~~~~~~~~~~~~~~~~~~ + 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index c720d00553..f5675fd62a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, 9) +VERSION = (6, 1, "10a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From ff221b103a4fb91889f7e8e2ebc6fd6dd43d7083 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 7 Jul 2023 22:36:43 +0300 Subject: [PATCH 02/34] Resolved an issue that caused generated projects for PlatformIO IDE for VSCode to break when the ``-iprefix`` compiler flag was used --- HISTORY.rst | 2 ++ platformio/builder/tools/piointegration.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index aa87ed80e5..2ed70050b6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,8 @@ PlatformIO Core 6 6.1.10 (2023-??-??) ~~~~~~~~~~~~~~~~~~~ +* Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode `__ to break when the ``-iprefix`` compiler flag was used + 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piointegration.py b/platformio/builder/tools/piointegration.py index 25ca1eb070..883689295a 100644 --- a/platformio/builder/tools/piointegration.py +++ b/platformio/builder/tools/piointegration.py @@ -12,11 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - import glob import os +import shlex -import click import SCons.Defaults # pylint: disable=import-error import SCons.Subst # pylint: disable=import-error from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error @@ -145,6 +144,11 @@ def _subst_cmd(env, cmd): return " ".join([SCons.Subst.quote_spaces(arg) for arg in args]) +def _split_flags_string(s): + flags = shlex.split(s, posix=False) + return [f[1:-1] if f.startswith('"') and f.endswith('"') else f for f in flags] + + def DumpIntegrationData(*args): projenv, globalenv = args[0:2] # pylint: disable=unbalanced-tuple-unpacking data = { @@ -155,10 +159,10 @@ def DumpIntegrationData(*args): ], "defines": dump_defines(projenv), "includes": projenv.DumpIntegrationIncludes(), - "cc_flags": click.parser.split_arg_string( + "cc_flags": _split_flags_string( _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS") ), - "cxx_flags": click.parser.split_arg_string( + "cxx_flags": _split_flags_string( _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS") ), "cc_path": where_is_program( From a102fd2d48f72a0474a460effcdfcfaefb5bc257 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 7 Jul 2023 22:36:58 +0300 Subject: [PATCH 03/34] Bump version to 6.1.10a2 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index f5675fd62a..c258bfc162 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "10a1") +VERSION = (6, 1, "10a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From bf8f1e9efb68a249b8627aade256a450d11511e0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 7 Jul 2023 22:48:09 +0300 Subject: [PATCH 04/34] Remove redundant code --- platformio/builder/tools/piointegration.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/platformio/builder/tools/piointegration.py b/platformio/builder/tools/piointegration.py index 883689295a..6f0a972ee1 100644 --- a/platformio/builder/tools/piointegration.py +++ b/platformio/builder/tools/piointegration.py @@ -14,7 +14,6 @@ import glob import os -import shlex import SCons.Defaults # pylint: disable=import-error import SCons.Subst # pylint: disable=import-error @@ -139,14 +138,9 @@ def dump_svd_path(env): return None -def _subst_cmd(env, cmd): - args = env.subst_list(cmd, SCons.Subst.SUBST_CMD)[0] - return " ".join([SCons.Subst.quote_spaces(arg) for arg in args]) - - -def _split_flags_string(s): - flags = shlex.split(s, posix=False) - return [f[1:-1] if f.startswith('"') and f.endswith('"') else f for f in flags] +def _split_flags_string(env, s): + args = env.subst_list(s, SCons.Subst.SUBST_CMD)[0] + return [str(arg) for arg in args] def DumpIntegrationData(*args): @@ -159,12 +153,8 @@ def DumpIntegrationData(*args): ], "defines": dump_defines(projenv), "includes": projenv.DumpIntegrationIncludes(), - "cc_flags": _split_flags_string( - _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS") - ), - "cxx_flags": _split_flags_string( - _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS") - ), + "cc_flags": _split_flags_string(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS"), + "cxx_flags": _split_flags_string(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS"), "cc_path": where_is_program( globalenv.subst("$CC"), globalenv.subst("${ENV['PATH']}") ), From 68e62c7137858b54d1835d3e24648fdaf61f5ccf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Jul 2023 17:41:21 +0300 Subject: [PATCH 05/34] Expose sizedata API --- platformio/builder/tools/piosize.py | 69 ++++++++++++++++------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/platformio/builder/tools/piosize.py b/platformio/builder/tools/piosize.py index f562fe64cb..aea85784e1 100644 --- a/platformio/builder/tools/piosize.py +++ b/platformio/builder/tools/piosize.py @@ -73,30 +73,6 @@ def _get_demangled_names(env, mangled_names): ) -def _determine_section(sections, symbol_addr): - for section, info in sections.items(): - if not _is_flash_section(info) and not _is_ram_section(info): - continue - if symbol_addr in range(info["start_addr"], info["start_addr"] + info["size"]): - return section - return "unknown" - - -def _is_ram_section(section): - return ( - section.get("type", "") in ("SHT_NOBITS", "SHT_PROGBITS") - and section.get("flags", "") == "WA" - ) - - -def _is_flash_section(section): - return section.get("type", "") == "SHT_PROGBITS" and "A" in section.get("flags", "") - - -def _is_valid_symbol(symbol_name, symbol_type, symbol_address): - return symbol_name and symbol_address != 0 and symbol_type != "STT_NOTYPE" - - def _collect_sections_info(elffile): sections = {} for section in elffile.iter_sections(): @@ -136,7 +112,7 @@ def _collect_symbols_info(env, elffile, elf_path, sections): symbol_size = s["st_size"] symbol_type = symbol_info["type"] - if not _is_valid_symbol(s.name, symbol_type, symbol_addr): + if not env.pioSizeIsValidSymbol(s.name, symbol_type, symbol_addr): continue symbol = { @@ -145,7 +121,7 @@ def _collect_symbols_info(env, elffile, elf_path, sections): "name": s.name, "type": symbol_type, "size": symbol_size, - "section": _determine_section(sections, symbol_addr), + "section": env.pioSizeDetermineSection(sections, symbol_addr), } if s.name.startswith("_Z"): @@ -175,12 +151,36 @@ def _collect_symbols_info(env, elffile, elf_path, sections): return symbols -def _calculate_firmware_size(sections): +def pioSizeDetermineSection(env, sections, symbol_addr): + for section, info in sections.items(): + if not env.pioSizeIsFlashSection(info) and not env.pioSizeIsRamSection(info): + continue + if symbol_addr in range(info["start_addr"], info["start_addr"] + info["size"]): + return section + return "unknown" + + +def pioSizeIsValidSymbol(_, symbol_name, symbol_type, symbol_address): + return symbol_name and symbol_address != 0 and symbol_type != "STT_NOTYPE" + + +def pioSizeIsRamSection(_, section): + return ( + section.get("type", "") in ("SHT_NOBITS", "SHT_PROGBITS") + and section.get("flags", "") == "WA" + ) + + +def pioSizeIsFlashSection(_, section): + return section.get("type", "") == "SHT_PROGBITS" and "A" in section.get("flags", "") + + +def pioSizeCalculateFirmwareSize(env, sections): flash_size = ram_size = 0 for section_info in sections.values(): - if _is_flash_section(section_info): + if env.pioSizeIsFlashSection(section_info): flash_size += section_info.get("size", 0) - if _is_ram_section(section_info): + if env.pioSizeIsRamSection(section_info): ram_size += section_info.get("size", 0) return ram_size, flash_size @@ -211,7 +211,7 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument env.Exit(1) sections = _collect_sections_info(elffile) - firmware_ram, firmware_flash = _calculate_firmware_size(sections) + firmware_ram, firmware_flash = env.pioSizeCalculateFirmwareSize(sections) data["memory"]["total"] = { "ram_size": firmware_ram, "flash_size": firmware_flash, @@ -226,9 +226,9 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument symbol_size = symbol.get("size", 0) section = sections.get(symbol.get("section", ""), {}) - if _is_ram_section(section): + if env.pioSizeIsRamSection(section): files[file_path]["ram_size"] += symbol_size - if _is_flash_section(section): + if env.pioSizeIsFlashSection(section): files[file_path]["flash_size"] += symbol_size files[file_path]["symbols"].append(symbol) @@ -250,5 +250,10 @@ def exists(_): def generate(env): + env.AddMethod(pioSizeIsRamSection) + env.AddMethod(pioSizeIsFlashSection) + env.AddMethod(pioSizeCalculateFirmwareSize) + env.AddMethod(pioSizeDetermineSection) + env.AddMethod(pioSizeIsValidSymbol) env.AddMethod(DumpSizeData) return env From be4d016f615ed6f72522badb7dbeed5a12e45ff0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 11 Jul 2023 14:23:05 +0300 Subject: [PATCH 06/34] Resolved an issue with "pio pkg exec" command on WIndows while executing Python scripts from a package --- HISTORY.rst | 1 + platformio/package/commands/exec.py | 8 ++++++-- platformio/proc.py | 16 ++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 2ed70050b6..b87270c6c3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,6 +19,7 @@ PlatformIO Core 6 ~~~~~~~~~~~~~~~~~~~ * Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode `__ to break when the ``-iprefix`` compiler flag was used +* Resolved an issue encountered while utilizing the `pio pkg exec `__ command on the Windows platform to execute Python scripts from a package 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/package/commands/exec.py b/platformio/package/commands/exec.py index fc100f1901..41386d5e4d 100644 --- a/platformio/package/commands/exec.py +++ b/platformio/package/commands/exec.py @@ -20,7 +20,7 @@ from platformio.compat import IS_MACOS, IS_WINDOWS from platformio.exception import ReturnErrorCode, UserSideException from platformio.package.manager.tool import ToolPackageManager -from platformio.proc import get_pythonexe_path +from platformio.proc import get_pythonexe_path, where_is_program @click.command("exec", short_help="Run command from package tool") @@ -52,9 +52,13 @@ def package_exec_cmd(obj, package, call, args): inject_pkg_to_environ(pkg) os.environ["PIO_PYTHON_EXE"] = get_pythonexe_path() + # inject current python interpreter on Windows - if IS_WINDOWS and args and args[0].endswith(".py"): + if args[0].endswith(".py"): args = [os.environ["PIO_PYTHON_EXE"]] + list(args) + if not os.path.exists(args[1]): + args[1] = where_is_program(args[1]) + result = None try: run_options = dict(shell=call is not None, env=os.environ) diff --git a/platformio/proc.py b/platformio/proc.py index fb66bc7ffb..acfce4d942 100644 --- a/platformio/proc.py +++ b/platformio/proc.py @@ -185,10 +185,17 @@ def copy_pythonpath_to_osenv(): def where_is_program(program, envpath=None): - env = os.environ + env = os.environ.copy() if envpath: env["PATH"] = envpath + # look up in $PATH + for bin_dir in env.get("PATH", "").split(os.pathsep): + if os.path.isfile(os.path.join(bin_dir, program)): + return os.path.join(bin_dir, program) + if IS_WINDOWS and os.path.isfile(os.path.join(bin_dir, "%s.exe" % program)): + return os.path.join(bin_dir, "%s.exe" % program) + # try OS's built-in commands try: result = exec_command(["where" if IS_WINDOWS else "which", program], env=env) @@ -197,13 +204,6 @@ def where_is_program(program, envpath=None): except OSError: pass - # look up in $PATH - for bin_dir in env.get("PATH", "").split(os.pathsep): - if os.path.isfile(os.path.join(bin_dir, program)): - return os.path.join(bin_dir, program) - if os.path.isfile(os.path.join(bin_dir, "%s.exe" % program)): - return os.path.join(bin_dir, "%s.exe" % program) - return program From abda3edad644522eafc4219ba151e37c46aba5db Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 11 Jul 2023 15:20:57 +0300 Subject: [PATCH 07/34] Use "UNIX_TIME" as the main variable --- platformio/builder/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 2ca41f38cc..7515e43f5b 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -72,8 +72,7 @@ variables=clivars, # Propagating External Environment ENV=os.environ, - TIMESTAMP=int(time()), - UNIX_TIME="$TIMESTAMP", # deprecated + UNIX_TIME=int(time()), BUILD_DIR=os.path.join("$PROJECT_BUILD_DIR", "$PIOENV"), BUILD_SRC_DIR=os.path.join("$BUILD_DIR", "src"), BUILD_TEST_DIR=os.path.join("$BUILD_DIR", "test"), From a423a4dde4a9ea77930e05303285fee0b64b8b2d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 11 Jul 2023 20:12:20 +0300 Subject: [PATCH 08/34] Rename "PackageMetaData" class to "PackageMetadata" --- platformio/package/manager/base.py | 4 ++-- platformio/package/meta.py | 8 ++++---- tests/package/test_meta.py | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/platformio/package/manager/base.py b/platformio/package/manager/base.py index c4d8d5bd02..f197ea120d 100644 --- a/platformio/package/manager/base.py +++ b/platformio/package/manager/base.py @@ -35,7 +35,7 @@ from platformio.package.manifest.parser import ManifestParserFactory from platformio.package.meta import ( PackageItem, - PackageMetaData, + PackageMetadata, PackageSpec, PackageType, ) @@ -199,7 +199,7 @@ def generate_rand_version(): def build_metadata(self, pkg_dir, spec, vcs_revision=None): manifest = self.load_manifest(pkg_dir) - metadata = PackageMetaData( + metadata = PackageMetadata( type=self.pkg_type, name=manifest.get("name"), version=manifest.get("version"), diff --git a/platformio/package/meta.py b/platformio/package/meta.py index 36578a3726..b1c491d784 100644 --- a/platformio/package/meta.py +++ b/platformio/package/meta.py @@ -401,7 +401,7 @@ def _parse_name_from_uri(uri): return name -class PackageMetaData: +class PackageMetadata: def __init__( # pylint: disable=redefined-builtin self, type, name, version, spec=None ): @@ -416,7 +416,7 @@ def __init__( # pylint: disable=redefined-builtin def __repr__(self): return ( - "PackageMetaData Date: Tue, 11 Jul 2023 20:13:26 +0300 Subject: [PATCH 09/34] Normalize configuration file path --- platformio/home/rpc/handlers/project.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platformio/home/rpc/handlers/project.py b/platformio/home/rpc/handlers/project.py index 65d05063a0..f833c7cea4 100644 --- a/platformio/home/rpc/handlers/project.py +++ b/platformio/home/rpc/handlers/project.py @@ -37,8 +37,12 @@ class ProjectRPC(BaseRPCHandler): def config_call(init_kwargs, method, *args): assert isinstance(init_kwargs, dict) assert "path" in init_kwargs - project_dir = get_project_dir() - if os.path.isfile(init_kwargs["path"]): + if os.path.isdir(init_kwargs["path"]): + project_dir = init_kwargs["path"] + init_kwargs["path"] = os.path.join(init_kwargs["path"], "platformio.ini") + elif os.path.isfile(init_kwargs["path"]): + project_dir = get_project_dir() + else: project_dir = os.path.dirname(init_kwargs["path"]) with fs.cd(project_dir): return getattr(ProjectConfig(**init_kwargs), method)(*args) From f85c3081fe01045a6f147a6b9c9e45cfcc970b68 Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 11 Jul 2023 22:12:54 +0300 Subject: [PATCH 10/34] Minor improvements for firmware memory footprint analysis - Added section name to the section data so that a dev-platform can apply a regex to determine section location in memory - Performance improvement by analyzing memory location of a firmware section only once --- platformio/builder/tools/piosize.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/platformio/builder/tools/piosize.py b/platformio/builder/tools/piosize.py index aea85784e1..082c7b6292 100644 --- a/platformio/builder/tools/piosize.py +++ b/platformio/builder/tools/piosize.py @@ -53,7 +53,7 @@ def _get_symbol_locations(env, elf_path, addrs): locations = [line for line in result["out"].split("\n") if line] assert len(addrs) == len(locations) - return dict(zip(addrs, [l.strip() for l in locations])) + return dict(zip(addrs, [loc.strip() for loc in locations])) def _get_demangled_names(env, mangled_names): @@ -73,7 +73,7 @@ def _get_demangled_names(env, mangled_names): ) -def _collect_sections_info(elffile): +def _collect_sections_info(env, elffile): sections = {} for section in elffile.iter_sections(): if section.is_null() or section.name.startswith(".debug"): @@ -83,13 +83,18 @@ def _collect_sections_info(elffile): section_flags = describe_sh_flags(section["sh_flags"]) section_size = section.data_size - sections[section.name] = { + section_data = { + "name": section.name, "size": section_size, "start_addr": section["sh_addr"], "type": section_type, "flags": section_flags, } + sections[section.name] = section_data + sections[section.name]["in_flash"] = env.pioSizeIsFlashSection(section_data) + sections[section.name]["in_ram"] = env.pioSizeIsRamSection(section_data) + return sections @@ -153,7 +158,7 @@ def _collect_symbols_info(env, elffile, elf_path, sections): def pioSizeDetermineSection(env, sections, symbol_addr): for section, info in sections.items(): - if not env.pioSizeIsFlashSection(info) and not env.pioSizeIsRamSection(info): + if not info.get("in_flash", False) and not info.get("in_ram", False): continue if symbol_addr in range(info["start_addr"], info["start_addr"] + info["size"]): return section @@ -178,9 +183,9 @@ def pioSizeIsFlashSection(_, section): def pioSizeCalculateFirmwareSize(env, sections): flash_size = ram_size = 0 for section_info in sections.values(): - if env.pioSizeIsFlashSection(section_info): + if section_info.get("in_flash", False): flash_size += section_info.get("size", 0) - if env.pioSizeIsRamSection(section_info): + if section_info.get("in_ram", False): ram_size += section_info.get("size", 0) return ram_size, flash_size @@ -210,7 +215,7 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument sys.stderr.write("Elf file doesn't contain DWARF information") env.Exit(1) - sections = _collect_sections_info(elffile) + sections = _collect_sections_info(env, elffile) firmware_ram, firmware_flash = env.pioSizeCalculateFirmwareSize(sections) data["memory"]["total"] = { "ram_size": firmware_ram, @@ -226,9 +231,11 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument symbol_size = symbol.get("size", 0) section = sections.get(symbol.get("section", ""), {}) - if env.pioSizeIsRamSection(section): + if not section: + continue + if section.get("in_ram", False): files[file_path]["ram_size"] += symbol_size - if env.pioSizeIsFlashSection(section): + if section.get("in_flash", False): files[file_path]["flash_size"] += symbol_size files[file_path]["symbols"].append(symbol) From 39b61d50e6593ff8beda0b14df4057133db4a3d3 Mon Sep 17 00:00:00 2001 From: valeros Date: Wed, 12 Jul 2023 10:39:50 +0300 Subject: [PATCH 11/34] Fix issues reported by Pylint --- platformio/builder/tools/piosize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/builder/tools/piosize.py b/platformio/builder/tools/piosize.py index 082c7b6292..3ac24311e8 100644 --- a/platformio/builder/tools/piosize.py +++ b/platformio/builder/tools/piosize.py @@ -156,7 +156,7 @@ def _collect_symbols_info(env, elffile, elf_path, sections): return symbols -def pioSizeDetermineSection(env, sections, symbol_addr): +def pioSizeDetermineSection(_, sections, symbol_addr): for section, info in sections.items(): if not info.get("in_flash", False) and not info.get("in_ram", False): continue @@ -180,7 +180,7 @@ def pioSizeIsFlashSection(_, section): return section.get("type", "") == "SHT_PROGBITS" and "A" in section.get("flags", "") -def pioSizeCalculateFirmwareSize(env, sections): +def pioSizeCalculateFirmwareSize(_, sections): flash_size = ram_size = 0 for section_info in sections.values(): if section_info.get("in_flash", False): From db8f027f3079a12791ecfe5070356ff156f623d5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 12 Jul 2023 18:28:20 +0300 Subject: [PATCH 12/34] Refactor platform-related calls to PlatformFactory.from_env --- platformio/builder/main.py | 1 - platformio/builder/tools/pioplatform.py | 4 +-- platformio/debug/cli.py | 4 +-- platformio/package/commands/install.py | 2 +- platformio/package/commands/list.py | 21 +++++++------ platformio/package/commands/outdated.py | 42 +++++++++++-------------- platformio/platform/_run.py | 3 -- platformio/platform/base.py | 1 + platformio/platform/factory.py | 13 ++++++++ platformio/project/commands/init.py | 8 ++--- platformio/run/processor.py | 10 +++--- platformio/test/runners/base.py | 4 +-- 12 files changed, 57 insertions(+), 56 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 7515e43f5b..ea8b202b3e 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -38,7 +38,6 @@ # append CLI arguments to build environment clivars = Variables(None) clivars.AddVariables( - ("PLATFORM_MANIFEST",), ("BUILD_SCRIPT",), ("PROJECT_CONFIG",), ("PIOENV",), diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index d13c78ec77..4ce4b91d59 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -33,9 +33,7 @@ @util.memoized() def _PioPlatform(): env = DefaultEnvironment() - p = PlatformFactory.new(os.path.dirname(env["PLATFORM_MANIFEST"])) - p.configure_project_packages(env["PIOENV"], COMMAND_LINE_TARGETS) - return p + return PlatformFactory.from_env(env["PIOENV"], targets=COMMAND_LINE_TARGETS) def PioPlatform(_): diff --git a/platformio/debug/cli.py b/platformio/debug/cli.py index 12d6004af4..5c9375aec0 100644 --- a/platformio/debug/cli.py +++ b/platformio/debug/cli.py @@ -109,9 +109,7 @@ def cli( def _configure(ctx, project_config, env_name, load_mode, verbose, __unprocessed): - platform = PlatformFactory.new( - project_config.get(f"env:{env_name}", "platform"), autoinstall=True - ) + platform = PlatformFactory.from_env(env_name, autoinstall=True) debug_config = DebugConfigFactory.new( platform, project_config, diff --git a/platformio/package/commands/install.py b/platformio/package/commands/install.py index e3eb05aa99..82c377d024 100644 --- a/platformio/package/commands/install.py +++ b/platformio/package/commands/install.py @@ -206,7 +206,7 @@ def _install_project_env_libraries(project_env, options): config = ProjectConfig.get_instance() compatibility_qualifiers = {} - if config.get(f"env:{project_env}", "platform"): + if config.get(f"env:{project_env}", "platform", None): try: p = PlatformFactory.new(config.get(f"env:{project_env}", "platform")) compatibility_qualifiers["platforms"] = [p.name] diff --git a/platformio/package/commands/list.py b/platformio/package/commands/list.py index 9d5fee4046..dd19973a47 100644 --- a/platformio/package/commands/list.py +++ b/platformio/package/commands/list.py @@ -22,6 +22,7 @@ from platformio.package.manager.platform import PlatformPackageManager from platformio.package.manager.tool import ToolPackageManager from platformio.package.meta import PackageItem, PackageSpec +from platformio.platform.exception import UnknownPlatform from platformio.platform.factory import PlatformFactory from platformio.project.config import ProjectConfig @@ -187,20 +188,20 @@ def list_project_packages(options): def print_project_env_platform_packages(project_env, options): - config = ProjectConfig.get_instance() - platform = config.get(f"env:{project_env}", "platform") - if not platform: - return None - pkg = PlatformPackageManager().get_package(platform) - if not pkg: + try: + p = PlatformFactory.from_env(project_env) + except UnknownPlatform: return None click.echo( "Platform %s" - % (humanize_package(pkg, platform, verbose=options.get("verbose"))) + % ( + humanize_package( + PlatformPackageManager().get_package(p.get_dir()), + p.config.get(f"env:{project_env}", "platform"), + verbose=options.get("verbose"), + ) + ) ) - p = PlatformFactory.new(pkg) - if project_env: - p.configure_project_packages(project_env) print_dependency_tree( p.pm, specs=[p.get_package_spec(name) for name in p.packages], diff --git a/platformio/package/commands/outdated.py b/platformio/package/commands/outdated.py index 18c3783aa1..769c937466 100644 --- a/platformio/package/commands/outdated.py +++ b/platformio/package/commands/outdated.py @@ -62,10 +62,9 @@ def is_outdated(self): ) @click.option("-e", "--environment", "environments", multiple=True) def package_outdated_cmd(project_dir, environments): - candidates = fetch_outdated_candidates( - project_dir, environments, with_progress=True - ) - print_outdated_candidates(candidates) + with fs.cd(project_dir): + candidates = fetch_outdated_candidates(environments, with_progress=True) + print_outdated_candidates(candidates) def print_outdated_candidates(candidates): @@ -126,8 +125,10 @@ def get_candidate_update_color(outdated): return None -def fetch_outdated_candidates(project_dir, environments, with_progress=False): +def fetch_outdated_candidates(environments, with_progress=False): candidates = [] + config = ProjectConfig.get_instance() + config.validate(environments) def _add_candidate(data): new_candidate = OutdatedCandidate( @@ -139,20 +140,16 @@ def _add_candidate(data): return candidates.append(new_candidate) - with fs.cd(project_dir): - config = ProjectConfig.get_instance() - config.validate(environments) - - # platforms - for item in find_platform_candidates(config, environments): - _add_candidate(item) - # platform package dependencies - for dep_item in find_platform_dependency_candidates(item): - _add_candidate(dep_item) + # platforms + for item in find_platform_candidates(config, environments): + _add_candidate(item) + # platform package dependencies + for dep_item in find_platform_dependency_candidates(item["env"]): + _add_candidate(dep_item) - # libraries - for item in find_library_candidates(config, environments): - _add_candidate(item) + # libraries + for item in find_library_candidates(config, environments): + _add_candidate(item) result = [] if not with_progress: @@ -172,7 +169,7 @@ def find_platform_candidates(config, environments): result = [] pm = PlatformPackageManager() for env in config.envs(): - platform = config.get(f"env:{env}", "platform") + platform = config.get(f"env:{env}", "platform", None) if not platform or (environments and env not in environments): continue spec = PackageSpec(platform) @@ -183,14 +180,13 @@ def find_platform_candidates(config, environments): return result -def find_platform_dependency_candidates(platform_candidate): +def find_platform_dependency_candidates(env): result = [] - p = PlatformFactory.new(platform_candidate["spec"]) - p.configure_project_packages(platform_candidate["env"]) + p = PlatformFactory.from_env(env) for pkg in p.get_installed_packages(): result.append( dict( - env=platform_candidate["env"], + env=env, pm=p.pm, pkg=pkg, spec=p.get_package_spec(pkg.metadata.name), diff --git a/platformio/platform/_run.py b/platformio/platform/_run.py index daca77c311..949a452da5 100644 --- a/platformio/platform/_run.py +++ b/platformio/platform/_run.py @@ -51,13 +51,10 @@ def run( # pylint: disable=too-many-arguments assert isinstance(targets, list) self.ensure_engine_compatible() - self.configure_project_packages(variables["pioenv"], targets) self.silent = silent self.verbose = verbose or app.get_setting("force_verbose") - variables["platform_manifest"] = self.manifest_path - if "build_script" not in variables: variables["build_script"] = self.get_build_script() if not os.path.isfile(variables["build_script"]): diff --git a/platformio/platform/base.py b/platformio/platform/base.py index 3231bb4444..51b02216a5 100644 --- a/platformio/platform/base.py +++ b/platformio/platform/base.py @@ -34,6 +34,7 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub def __init__(self, manifest_path): self.manifest_path = manifest_path + self.project_env = None # set by factory.from_env(env) self.silent = False self.verbose = False diff --git a/platformio/platform/factory.py b/platformio/platform/factory.py index b628590cd9..334888b553 100644 --- a/platformio/platform/factory.py +++ b/platformio/platform/factory.py @@ -21,6 +21,8 @@ from platformio.package.meta import PackageItem from platformio.platform import base from platformio.platform.exception import UnknownPlatform +from platformio.project.config import ProjectConfig +from platformio.project.exception import UndefinedEnvPlatformError class PlatformFactory: @@ -88,3 +90,14 @@ def new(cls, pkg_or_spec, autoinstall=False) -> base.PlatformBase: _instance = platform_cls(os.path.join(platform_dir, "platform.json")) assert isinstance(_instance, base.PlatformBase) return _instance + + @classmethod + def from_env(cls, env, targets=None, autoinstall=False): + config = ProjectConfig.get_instance() + spec = config.get(f"env:{env}", "platform", None) + if not spec: + raise UndefinedEnvPlatformError(env) + p = cls.new(spec, autoinstall=autoinstall) + p.project_env = env + p.configure_project_packages(env, targets) + return p diff --git a/platformio/project/commands/init.py b/platformio/project/commands/init.py index 098c31a57f..51ae46a48d 100644 --- a/platformio/project/commands/init.py +++ b/platformio/project/commands/init.py @@ -26,6 +26,7 @@ from platformio.platform.exception import UnknownBoard from platformio.platform.factory import PlatformFactory from platformio.project.config import ProjectConfig +from platformio.project.exception import UndefinedEnvPlatformError from platformio.project.helpers import is_platformio_project from platformio.project.integration.generator import ProjectGenerator from platformio.project.options import ProjectOptions @@ -366,13 +367,10 @@ def update_project_env(environment, extra_project_options=None): def init_sample_code(config, environment): - platform_spec = config.get(f"env:{environment}", "platform", None) - if not platform_spec: - return None - p = PlatformFactory.new(platform_spec) try: + p = PlatformFactory.from_env(environment) return p.generate_sample_code(config, environment) - except NotImplementedError: + except (NotImplementedError, UndefinedEnvPlatformError): pass framework = config.get(f"env:{environment}", "framework", None) diff --git a/platformio/run/processor.py b/platformio/run/processor.py index 329c4bf6d0..051e35afc2 100644 --- a/platformio/run/processor.py +++ b/platformio/run/processor.py @@ -72,8 +72,8 @@ def process(self): # pre-clean if is_clean: - result = PlatformFactory.new( - self.options["platform"], autoinstall=True + result = PlatformFactory.from_env( + self.name, targets=self.targets, autoinstall=True ).run(build_vars, self.targets, self.silent, self.verbose, self.jobs) if not build_targets: return result["returncode"] == 0 @@ -85,7 +85,7 @@ def process(self): "piotest_running_name": build_vars.get("piotest_running_name"), }, ) - result = PlatformFactory.new(self.options["platform"], autoinstall=True).run( - build_vars, build_targets, self.silent, self.verbose, self.jobs - ) + result = PlatformFactory.from_env( + self.name, targets=build_targets, autoinstall=True + ).run(build_vars, build_targets, self.silent, self.verbose, self.jobs) return result["returncode"] == 0 diff --git a/platformio/test/runners/base.py b/platformio/test/runners/base.py index 845a8c3771..e8919f84df 100644 --- a/platformio/test/runners/base.py +++ b/platformio/test/runners/base.py @@ -62,8 +62,8 @@ def __init__(self, test_suite, project_config, options=None): self.test_suite = test_suite self.options = options self.project_config = project_config - self.platform = PlatformFactory.new( - self.project_config.get(f"env:{self.test_suite.env_name}", "platform"), + self.platform = PlatformFactory.from_env( + self.test_suite.env_name, autoinstall=True, ) self.cmd_ctx = None From 940fa327f54fc3d0a3ddfd020288518d29d30c4d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 13 Jul 2023 17:14:59 +0300 Subject: [PATCH 13/34] Lock "starlette==0.29.0" to Python 3.7 --- setup.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index f37da675a6..aeef43341e 100644 --- a/setup.py +++ b/setup.py @@ -24,16 +24,16 @@ __version__, ) -env_marker_below_37 = "python_version < '3.7'" -env_marker_gte_37 = "python_version >= '3.7'" +py_below_37 = "python_version < '3.7'" +py_gte_37 = "python_version >= '3.7'" minimal_requirements = [ "bottle==0.12.*", - "click==8.0.4; " + env_marker_below_37, - "click==8.1.*; " + env_marker_gte_37, + "click==8.0.4; " + py_below_37, + "click==8.1.*; " + py_gte_37, "colorama", - "marshmallow==3.14.1; " + env_marker_below_37, - "marshmallow==3.19.*; " + env_marker_gte_37, + "marshmallow==3.14.1; " + py_below_37, + "marshmallow==3.19.*; " + py_gte_37, "pyelftools==0.29", "pyserial==3.5.*", # keep in sync "device/monitor/terminal.py" "requests==2.*", @@ -44,12 +44,13 @@ home_requirements = [ "aiofiles>=0.8.0", "ajsonrpc==1.2.*", - "starlette==0.19.1; " + env_marker_below_37, - "starlette==0.28.*; " + env_marker_gte_37, - "uvicorn==0.16.0; " + env_marker_below_37, - "uvicorn==0.22.*; " + env_marker_gte_37, - "wsproto==1.0.0; " + env_marker_below_37, - "wsproto==1.2.*; " + env_marker_gte_37, + "starlette==0.19.1; " + py_below_37, + "starlette==0.29.0; python_version == '3.7'", + "starlette==0.30.*; python_version >= '3.8'", + "uvicorn==0.16.0; " + py_below_37, + "uvicorn==0.22.*; " + py_gte_37, + "wsproto==1.0.0; " + py_below_37, + "wsproto==1.2.*; " + py_gte_37, ] # issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+ From bce70d49450368134f20f1486b60c641f224b833 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Jul 2023 12:08:41 +0300 Subject: [PATCH 14/34] Remove unnecessary dependencies --- platformio/telemetry.py | 2 +- setup.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 820b1507a6..b9892b8b63 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -135,7 +135,7 @@ def _commit_events(self, events): # print("_commit_payload", payload) try: r = self._http_session.post( - "https://telemetry.platformio.org/collect", + "https://collector.platformio.org/collect", json=payload, timeout=(2, 5), # connect, read ) diff --git a/setup.py b/setup.py index aeef43341e..5b3aa1146b 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,10 @@ __version__, ) +py_37 = "python_version == '3.7'" py_below_37 = "python_version < '3.7'" py_gte_37 = "python_version >= '3.7'" +py_gte_38 = "python_version >= '3.8'" minimal_requirements = [ "bottle==0.12.*", @@ -42,13 +44,13 @@ ] home_requirements = [ - "aiofiles>=0.8.0", "ajsonrpc==1.2.*", "starlette==0.19.1; " + py_below_37, - "starlette==0.29.0; python_version == '3.7'", - "starlette==0.30.*; python_version >= '3.8'", + "starlette==0.29.0; " + py_37, + "starlette==0.30.*; " + py_gte_38, "uvicorn==0.16.0; " + py_below_37, - "uvicorn==0.22.*; " + py_gte_37, + "uvicorn==0.22.0; " + py_37, + "uvicorn==0.23.*; " + py_gte_38, "wsproto==1.0.0; " + py_below_37, "wsproto==1.2.*; " + py_gte_37, ] From bc2e51d51fdf41ffa412a131f6f42df4db01cbf5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Jul 2023 12:09:15 +0300 Subject: [PATCH 15/34] Bump version to 6.1.10a3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index c258bfc162..2cd1ac9da1 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "10a2") +VERSION = (6, 1, "10a3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From deca77d1a30173e376cfc4aa9d9c86e1594fa65f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Jul 2023 14:22:27 +0300 Subject: [PATCH 16/34] Implement project.configuration endpoint --- platformio/home/rpc/handlers/project.py | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/platformio/home/rpc/handlers/project.py b/platformio/home/rpc/handlers/project.py index f833c7cea4..90b3ab78fe 100644 --- a/platformio/home/rpc/handlers/project.py +++ b/platformio/home/rpc/handlers/project.py @@ -25,6 +25,7 @@ from platformio.home.rpc.handlers.base import BaseRPCHandler from platformio.home.rpc.handlers.piocore import PIOCoreRPC from platformio.package.manager.platform import PlatformPackageManager +from platformio.platform.factory import PlatformFactory from platformio.project.config import ProjectConfig from platformio.project.exception import ProjectError from platformio.project.helpers import get_project_dir, is_platformio_project @@ -339,3 +340,47 @@ async def _pre_init_example(self, configuration, project_dir): encoding="utf-8", ) return [] + + @staticmethod + def configuration(project_dir, env): + assert is_platformio_project(project_dir) + with fs.cd(project_dir): + config = ProjectConfig(os.path.join(project_dir, "platformio.ini")) + platform = PlatformFactory.from_env(env, autoinstall=True) + platform_pkg = PlatformPackageManager().get_package(platform.get_dir()) + board_id = config.get(f"env:{env}", "board", None) + + # frameworks + frameworks = [] + for name in config.get(f"env:{env}", "framework", []): + if name not in platform.frameworks: + continue + f_pkg_name = platform.frameworks[name].get("package") + if not f_pkg_name: + continue + f_pkg = platform.get_package(f_pkg_name) + if not f_pkg: + continue + f_manifest = platform.pm.load_manifest(f_pkg) + frameworks.append( + dict( + name=name, + title=f_manifest.get("title"), + version=str(f_pkg.metadata.version), + ) + ) + + return dict( + platform=dict( + ownername=platform_pkg.metadata.spec.owner + if platform_pkg.metadata.spec + else None, + name=platform.name, + title=platform.title, + version=str(platform_pkg.metadata.version), + ), + board=platform.board_config(board_id).get_brief_data() + if board_id + else None, + frameworks=frameworks or None, + ) From 390755c4995ac60376a3197932283b488bba195c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Jul 2023 14:56:56 +0300 Subject: [PATCH 17/34] Implement app.get_project_id() --- platformio/app.py | 4 ++++ platformio/telemetry.py | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index d94cdfefc7..f629ff13e9 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -258,6 +258,10 @@ def get_cid(): return cid +def get_project_id(project_dir): + return hashlib.sha1(hashlib_encode_data(project_dir)).hexdigest() + + def get_user_agent(): data = [ "PlatformIO/%s" % __version__, diff --git a/platformio/telemetry.py b/platformio/telemetry.py index b9892b8b63..ceb0929610 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -13,7 +13,6 @@ # limitations under the License. import atexit -import hashlib import os import queue import re @@ -27,7 +26,6 @@ from platformio import __title__, __version__, app, exception, fs, util from platformio.cli import PlatformioCLI -from platformio.compat import hashlib_encode_data from platformio.debug.config.base import DebugConfigBase from platformio.http import HTTPSession, ensure_internet_on from platformio.proc import is_ci @@ -220,7 +218,7 @@ def dump_project_env_params(config, env, platform): for option in non_sensitive_data if config.has_option(section, option) } - params["pid"] = hashlib.sha1(hashlib_encode_data(config.path)).hexdigest() + params["pid"] = app.get_project_id(os.path.dirname(config.path)) params["platform_name"] = platform.name params["platform_version"] = platform.version return params From 0fe6bf262edece08fb694f82dad82cf1daf55030 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Jul 2023 15:15:21 +0300 Subject: [PATCH 18/34] Ensure that the ``monitor`` target is not executed if any of the preceding targets encounter failures --- HISTORY.rst | 1 + platformio/run/cli.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index b87270c6c3..014fc8f3d4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,7 @@ PlatformIO Core 6 * Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode `__ to break when the ``-iprefix`` compiler flag was used * Resolved an issue encountered while utilizing the `pio pkg exec `__ command on the Windows platform to execute Python scripts from a package +* Implemented a crucial improvement to the `pio run `__ command, guaranteeing that the ``monitor`` target is not executed if any of the preceding targets, such as ``upload``, encounter failures 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/run/cli.py b/platformio/run/cli.py index dc3eb2ee51..1ed84a48b0 100644 --- a/platformio/run/cli.py +++ b/platformio/run/cli.py @@ -207,7 +207,7 @@ def process_env( verbose, ).process() - if "monitor" in targets and "nobuild" not in targets: + if result["succeeded"] and "monitor" in targets and "nobuild" not in targets: ctx.invoke( device_monitor_cmd, port=monitor_port, From 5c9b373b656f088b4fd506f49512e1880168da4f Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 17 Jul 2023 14:12:52 +0300 Subject: [PATCH 19/34] Update Cppcheck to v2.11 --- HISTORY.rst | 1 + platformio/__init__.py | 2 +- tests/commands/test_check.py | 41 +++++++++++++++++------------------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 014fc8f3d4..cfe23a1cca 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,6 +21,7 @@ PlatformIO Core 6 * Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode `__ to break when the ``-iprefix`` compiler flag was used * Resolved an issue encountered while utilizing the `pio pkg exec `__ command on the Windows platform to execute Python scripts from a package * Implemented a crucial improvement to the `pio run `__ command, guaranteeing that the ``monitor`` target is not executed if any of the preceding targets, such as ``upload``, encounter failures +* `Cppcheck `__ v2.11 with new checks, CLI commands and various analysis improvements 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 2cd1ac9da1..aa43c2d194 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -46,7 +46,7 @@ "contrib-piohome": "~3.4.2", "contrib-pioremote": "~1.0.0", "tool-scons": "~4.40502.0", - "tool-cppcheck": "~1.270.0", + "tool-cppcheck": "~1.21100.0", "tool-clangtidy": "~1.150005.0", "tool-pvs-studio": "~7.18.0", } diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index cb6f77772c..91679d03e5 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -69,7 +69,7 @@ EXPECTED_ERRORS = 5 EXPECTED_WARNINGS = 1 -EXPECTED_STYLE = 2 +EXPECTED_STYLE = 4 EXPECTED_DEFECTS = EXPECTED_ERRORS + EXPECTED_WARNINGS + EXPECTED_STYLE @@ -345,7 +345,10 @@ def test_check_individual_flags_passed(clirunner, validate_cliresult, tmpdir): assert pvs_flags_found -def test_check_cppcheck_misra_addon(clirunner, validate_cliresult, check_dir): +def test_check_cppcheck_misra_addon(clirunner, validate_cliresult, tmpdir_factory): + check_dir = tmpdir_factory.mktemp("project") + check_dir.join("platformio.ini").write(DEFAULT_CONFIG) + check_dir.mkdir("src").join("main.c").write(TEST_CODE) check_dir.join("misra.json").write( """ { @@ -508,16 +511,18 @@ def test_check_pvs_studio_fails_broken_license(clirunner, tmpdir): assert verbose_result.exit_code != 0 assert "license information is incorrect" in verbose_result.output.lower() - -def test_check_embedded_platform_all_tools(clirunner, validate_cliresult, tmpdir): - config = """ +@pytest.mark.parametrize("framework", ["arduino", "stm32cube", "zephyr"]) +@pytest.mark.parametrize("check_tool", ["cppcheck", "clangtidy", "pvs-studio"]) +def test_check_embedded_platform_all_tools( + clirunner, validate_cliresult, tmpdir, framework, check_tool +): + config = f""" [env:test] platform = ststm32 board = nucleo_f401re -framework = %s -check_tool = %s +framework = {framework} +check_tool = {check_tool} """ - # tmpdir.join("platformio.ini").write(config) tmpdir.mkdir("src").join("main.c").write( PVS_STUDIO_FREE_LICENSE_HEADER + """ @@ -534,20 +539,12 @@ def test_check_embedded_platform_all_tools(clirunner, validate_cliresult, tmpdir """ ) - for framework in ( - "arduino", - "stm32cube", - "zephyr", - ): - for tool in ("cppcheck", "clangtidy", "pvs-studio"): - tmpdir.join("platformio.ini").write(config % (framework, tool)) - result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) - validate_cliresult(result) - defects = sum(count_defects(result.output)) - assert defects > 0, "Failed %s with %s" % ( - framework, - tool, - ) + + tmpdir.join("platformio.ini").write(config) + result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) + validate_cliresult(result) + defects = sum(count_defects(result.output)) + assert defects > 0, "Not defects were found!" def test_check_skip_includes_from_packages(clirunner, validate_cliresult, tmpdir): From 3268b516a9f3d4c6c533813e1bfb44b1b0f5f0d4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Jul 2023 15:03:57 +0300 Subject: [PATCH 20/34] Respect user privacy based on UA data --- platformio/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platformio/app.py b/platformio/app.py index f629ff13e9..7d2f1ea9b7 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -274,6 +274,8 @@ def get_user_agent(): data.append("IDE/%s" % os.getenv("PLATFORMIO_IDE")) data.append("Python/%s" % platform.python_version()) data.append("Platform/%s" % platform.platform()) + if not get_setting("enable_telemetry"): + data.append("Telemetry/0") return " ".join(data) From a983075dacdce1994402091222391000c8128ae0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Jul 2023 15:04:09 +0300 Subject: [PATCH 21/34] Update deps --- setup.py | 4 ++-- tests/commands/test_check.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5b3aa1146b..6d450519c7 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ "click==8.1.*; " + py_gte_37, "colorama", "marshmallow==3.14.1; " + py_below_37, - "marshmallow==3.19.*; " + py_gte_37, + "marshmallow==3.20.*; " + py_gte_37, "pyelftools==0.29", "pyserial==3.5.*", # keep in sync "device/monitor/terminal.py" "requests==2.*", @@ -47,7 +47,7 @@ "ajsonrpc==1.2.*", "starlette==0.19.1; " + py_below_37, "starlette==0.29.0; " + py_37, - "starlette==0.30.*; " + py_gte_38, + "starlette==0.31.*; " + py_gte_38, "uvicorn==0.16.0; " + py_below_37, "uvicorn==0.22.0; " + py_37, "uvicorn==0.23.*; " + py_gte_38, diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index 91679d03e5..5403ee0fa7 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -511,6 +511,7 @@ def test_check_pvs_studio_fails_broken_license(clirunner, tmpdir): assert verbose_result.exit_code != 0 assert "license information is incorrect" in verbose_result.output.lower() + @pytest.mark.parametrize("framework", ["arduino", "stm32cube", "zephyr"]) @pytest.mark.parametrize("check_tool", ["cppcheck", "clangtidy", "pvs-studio"]) def test_check_embedded_platform_all_tools( @@ -539,7 +540,6 @@ def test_check_embedded_platform_all_tools( """ ) - tmpdir.join("platformio.ini").write(config) result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) validate_cliresult(result) From 4474175e5279139ebe55ae35b4734042e7324b5b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Jul 2023 14:34:59 +0300 Subject: [PATCH 22/34] Docs: Sync renesas-ra dev-platform --- docs | 2 +- examples | 2 +- scripts/docspregen.py | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs b/docs index f8dbf012e4..5ae4fa7e89 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f8dbf012e4a7ddbe79279540e95c08a2d108c725 +Subproject commit 5ae4fa7e895f5d3a04514314b1af31b37469d274 diff --git a/examples b/examples index 4b572ec9fe..4bed26fd0d 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 4b572ec9fef6df5aacb1e113177f5ec28dda1cde +Subproject commit 4bed26fd0d0b559dcf52f6088c9c2b4ebffd5fd6 diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 09dd6777ec..a4d56c0382 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -51,6 +51,12 @@ "or physical experiences." ), }, + "cmsis": { + "title": "CMSIS", + "description": ( + "Vendor-independent hardware abstraction layer for the Cortex-M processor series" + ), + }, "freertos": { "title": "FreeRTOS", "description": ( From 54ff3a8d4ebbf63c67bb2f741b014b69e99c820f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Jul 2023 18:24:47 +0300 Subject: [PATCH 23/34] Test all compatible Pythons --- .github/workflows/core.yml | 3 ++- tox.ini | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 445e6e0eaa..10fcf10123 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-latest, macos-latest] - python-version: ["3.6", "3.9", "3.11"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] runs-on: ${{ matrix.os }} @@ -33,6 +33,7 @@ jobs: tox -e lint - name: Integration Tests + if: ${{ matrix.python-version == '3.9' }} run: | tox -e testcore diff --git a/tox.ini b/tox.ini index f8a15f3bc5..2eda9b906c 100644 --- a/tox.ini +++ b/tox.ini @@ -34,6 +34,7 @@ deps = jsondiff commands = {envpython} --version + pio system info [testenv:lint] commands = From 3a21f48c9ca3dd082c27189fdb0cba4556468290 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Jul 2023 18:37:30 +0300 Subject: [PATCH 24/34] Lock "marshmallow" dependency to the 3.19.0 for Python 3.7 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6d450519c7..ef9543e35e 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,8 @@ "click==8.1.*; " + py_gte_37, "colorama", "marshmallow==3.14.1; " + py_below_37, - "marshmallow==3.20.*; " + py_gte_37, + "marshmallow==3.19.0; " + py_37, + "marshmallow==3.20.*; " + py_gte_38, "pyelftools==0.29", "pyserial==3.5.*", # keep in sync "device/monitor/terminal.py" "requests==2.*", From dccc14b50772fdacd2b9392ab07498000f4b6b30 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Jul 2023 18:40:14 +0300 Subject: [PATCH 25/34] Ensure that PIO Core System Info works on all supported Pythons --- .github/workflows/core.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 10fcf10123..c7c020a3b5 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -27,6 +27,10 @@ jobs: python -m pip install --upgrade pip pip install tox + - name: Core System Info + run: | + tox -e py + - name: Python Lint if: ${{ matrix.python-version != '3.6' }} run: | From 831f7f52bc4b11c1b878d6ddddbd6154b9e27349 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Jul 2023 16:01:57 +0300 Subject: [PATCH 26/34] Automatically update PIO Core PyPi dependencies on "upgrade" operation --- platformio/__init__.py | 19 ++++++++++++++ platformio/commands/upgrade.py | 36 +++++++++++++++++++++---- setup.py | 48 +++------------------------------- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index aa43c2d194..8ca26c74d9 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -56,3 +56,22 @@ "88.198.170.159", # platformio.org "github.com", ] + __registry_mirror_hosts__ + +__install_requires__ = [ + # Core requirements + "bottle == 0.12.*", + "click >=8.0.4, <=8.2", + "colorama", + "marshmallow == 3.*", + "pyelftools == 0.29", + "pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py" + "requests == 2.*", + "semantic_version == 2.10.*", + "tabulate == 0.*", +] + [ + # PIO Home requirements + "ajsonrpc == 1.2.*", + "starlette >=0.19, <0.32", + "uvicorn >=0.16, <0.24", + "wsproto == 1.*", +] diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 9e4d61d2eb..3fb611eaa6 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -18,7 +18,7 @@ import click -from platformio import VERSION, __version__, app, exception +from platformio import VERSION, __install_requires__, __version__, app, exception from platformio.http import fetch_remote_content from platformio.package.manager.core import update_core_packages from platformio.proc import get_pythonexe_path @@ -33,9 +33,14 @@ @click.command("upgrade", short_help="Upgrade PlatformIO Core to the latest version") @click.option("--dev", is_flag=True, help="Use development branch") +@click.option("--only-dependencies", is_flag=True) @click.option("--verbose", "-v", is_flag=True) -def cli(dev, verbose): +def cli(dev, only_dependencies, verbose): + if only_dependencies: + return upgrade_pypi_dependencies(verbose) + update_core_packages() + if not dev and __version__ == get_latest_version(): return click.secho( "You're up-to-date!\nPlatformIO %s is currently the " @@ -50,11 +55,21 @@ def cli(dev, verbose): pkg_spec = DEVELOP_ZIP_URL if to_develop else "platformio" try: + # PIO Core subprocess.run( [python_exe, "-m", "pip", "install", "--upgrade", pkg_spec], check=True, stdout=subprocess.PIPE if not verbose else None, ) + + # PyPI dependencies + subprocess.run( + [python_exe, "-m", "platformio", "upgrade", "--only-dependencies"], + check=False, + stdout=subprocess.PIPE, + ) + + # Check version output = subprocess.run( [python_exe, "-m", "platformio", "--version"], check=True, @@ -87,9 +102,20 @@ def cli(dev, verbose): return True -def get_pkg_spec(to_develop): - if to_develop: - return +def upgrade_pypi_dependencies(verbose): + subprocess.run( + [ + get_pythonexe_path(), + "-m", + "pip", + "install", + "--upgrade", + "pip", + *__install_requires__, + ], + check=True, + stdout=subprocess.PIPE if not verbose else None, + ) def get_latest_version(): diff --git a/setup.py b/setup.py index ef9543e35e..5872ccf5ad 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import platform from setuptools import find_packages, setup from platformio import ( @@ -22,52 +23,9 @@ __title__, __url__, __version__, + __install_requires__, ) -py_37 = "python_version == '3.7'" -py_below_37 = "python_version < '3.7'" -py_gte_37 = "python_version >= '3.7'" -py_gte_38 = "python_version >= '3.8'" - -minimal_requirements = [ - "bottle==0.12.*", - "click==8.0.4; " + py_below_37, - "click==8.1.*; " + py_gte_37, - "colorama", - "marshmallow==3.14.1; " + py_below_37, - "marshmallow==3.19.0; " + py_37, - "marshmallow==3.20.*; " + py_gte_38, - "pyelftools==0.29", - "pyserial==3.5.*", # keep in sync "device/monitor/terminal.py" - "requests==2.*", - "semantic_version==2.10.*", - "tabulate==0.*", -] - -home_requirements = [ - "ajsonrpc==1.2.*", - "starlette==0.19.1; " + py_below_37, - "starlette==0.29.0; " + py_37, - "starlette==0.31.*; " + py_gte_38, - "uvicorn==0.16.0; " + py_below_37, - "uvicorn==0.22.0; " + py_37, - "uvicorn==0.23.*; " + py_gte_38, - "wsproto==1.0.0; " + py_below_37, - "wsproto==1.2.*; " + py_gte_37, -] - -# issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+ -try: - import ssl - - if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < ( - 1, - 1, - 1, - ): - minimal_requirements.append("urllib3<2") -except ImportError: - pass setup( @@ -79,7 +37,7 @@ author_email=__email__, url=__url__, license=__license__, - install_requires=minimal_requirements + home_requirements, + install_requires=__install_requires__, python_requires=">=3.6", packages=find_packages(include=["platformio", "platformio.*"]), package_data={ From 89f4574680e6269e562bff849a90372a33ed3c40 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Jul 2023 16:02:18 +0300 Subject: [PATCH 27/34] Remove unused files --- scripts/get-platformio.py | 105 -------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 scripts/get-platformio.py diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py deleted file mode 100644 index 9d99ea9771..0000000000 --- a/scripts/get-platformio.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright (c) 2014-present PlatformIO -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import tempfile -import io -import sys -import subprocess - -MAIN_SCRIPT_URL = "https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py" - - -def download_with_requests(url, dst): - import requests - - resp = requests.get(url, stream=True) - itercontent = resp.iter_content(chunk_size=io.DEFAULT_BUFFER_SIZE) - with open(dst, "wb") as fp: - for chunk in itercontent: - fp.write(chunk) - return dst - - -def download_with_urllib3(url, dst): - import urllib3 - - http = urllib3.PoolManager() - r = http.request("GET", url, preload_content=False) - - with open(dst, "wb") as out: - while True: - data = r.read(io.DEFAULT_BUFFER_SIZE) - if not data: - break - out.write(data) - - r.release_conn() - return dst - - -def download_with_urllib(url, dst): - if sys.version_info[0] == 3: - from urllib.request import urlopen - else: - from urllib import urlopen - - response = urlopen(url) - CHUNK = 16 * 1024 - with open(dst, "wb") as f: - while True: - chunk = response.read(CHUNK) - if not chunk: - break - f.write(chunk) - - return dst - - -def download_with_curl(url, dst): - subprocess.check_output(["curl", "-o", dst, url]) - return dst - - -def download_with_wget(url, dst): - subprocess.check_output(["wget", "-O", dst, url]) - return dst - - -def download_file(url, dst): - methods = [ - download_with_requests, - download_with_urllib3, - download_with_urllib, - download_with_curl, - download_with_wget, - ] - for method in methods: - try: - method(url, dst) - return dst - except: - pass - raise Exception("Could not download file '%s' to '%s' " % (url, dst)) - - -def main(): - with tempfile.NamedTemporaryFile() as tmp_file: - dst = download_file(MAIN_SCRIPT_URL, str(tmp_file.name)) - command = [sys.executable, dst] - command.extend(sys.argv[1:]) - subprocess.check_call(command) - - -if __name__ == "__main__": - sys.exit(main()) From 9170eee6e465b0baba9977e0fe964689f0e667bb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Jul 2023 16:03:14 +0300 Subject: [PATCH 28/34] Resolved an issue with "ModuleNotFoundError: No module named 'chardet'" on macOS ARM // Resolve #4702 --- HISTORY.rst | 1 + setup.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index cfe23a1cca..c66f136ca6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ PlatformIO Core 6 * Resolved an issue encountered while utilizing the `pio pkg exec `__ command on the Windows platform to execute Python scripts from a package * Implemented a crucial improvement to the `pio run `__ command, guaranteeing that the ``monitor`` target is not executed if any of the preceding targets, such as ``upload``, encounter failures * `Cppcheck `__ v2.11 with new checks, CLI commands and various analysis improvements +* Resolved a critical issue that arose on macOS ARM platforms due to the Python "requests" module, leading to a "ModuleNotFoundError: No module named 'chardet'" (`issue #4702 `_) 6.1.9 (2023-07-06) ~~~~~~~~~~~~~~~~~~ diff --git a/setup.py b/setup.py index 5872ccf5ad..46716cc507 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,9 @@ __install_requires__, ) +# issue #4702; Broken "requests/charset_normalizer" on macOS ARM +if platform.system() == "Darwin" and "arm" in platform.machine().lower(): + __install_requires__.append("chardet>=3.0.2,<4") setup( From f8b5266c1eafcc7c3528d8f845c531066dfe9758 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Jul 2023 16:04:20 +0300 Subject: [PATCH 29/34] Bump version to 6.1.10a4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 8ca26c74d9..643dcc2e49 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "10a3") +VERSION = (6, 1, "10a4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 48a823d39e54c2a1509ad22f0b8fe8c15e70f4cb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 4 Aug 2023 20:15:14 +0300 Subject: [PATCH 30/34] Do not check internet connection on the postponed telemetry // Resolve #4706 --- platformio/telemetry.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index ceb0929610..5b0734c9a2 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -27,7 +27,7 @@ from platformio import __title__, __version__, app, exception, fs, util from platformio.cli import PlatformioCLI from platformio.debug.config.base import DebugConfigBase -from platformio.http import HTTPSession, ensure_internet_on +from platformio.http import HTTPSession from platformio.proc import is_ci KEEP_MAX_REPORTS = 100 @@ -363,8 +363,6 @@ def postpone_events(events): def process_postponed_logs(): - if not ensure_internet_on(): - return None events = load_postponed_events() if not events: return None @@ -378,4 +376,5 @@ def process_postponed_logs(): timestamp=event["timestamp"], instant_sending=False, ) + telemetry.send() return True From 65397fe0591eb3d37056effcb015f5c1893a7206 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 4 Aug 2023 20:16:49 +0300 Subject: [PATCH 31/34] Bump version to 6.1.10b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 643dcc2e49..ccdc412801 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "10a4") +VERSION = (6, 1, "10b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From a733f3c868b259c64985c9474b41074413986d27 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 Aug 2023 12:07:16 +0300 Subject: [PATCH 32/34] Update slogan --- HISTORY.rst | 4 +++- README.rst | 6 ++++-- docs | 2 +- platformio/__init__.py | 14 +++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c66f136ca6..f6681b5446 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -13,7 +13,9 @@ Release Notes PlatformIO Core 6 ----------------- -**A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** +Unlock the true potential of embedded software development with +PlatformIO's collaborative ecosystem, embracing declarative principles, +test-driven methodologies, and modern toolchains for unrivaled success. 6.1.10 (2023-??-??) ~~~~~~~~~~~~~~~~~~~ diff --git a/README.rst b/README.rst index cd3454f52d..df73525eab 100644 --- a/README.rst +++ b/README.rst @@ -36,9 +36,11 @@ PlatformIO Core .. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-ide-laptop.png :target: https://platformio.org?utm_source=github&utm_medium=core -`PlatformIO `_ is a professional collaborative platform for embedded development. +`PlatformIO `_: Your Gateway to Embedded Software Development Excellence. -**A place where Developers and Teams have true Freedom! No more vendor lock-in!** +Unlock the true potential of embedded software development with +PlatformIO's collaborative ecosystem, embracing declarative principles, +test-driven methodologies, and modern toolchains for unrivaled success. * Open source, maximum permissive Apache 2.0 license * Cross-platform IDE and Unified Debugger diff --git a/docs b/docs index 5ae4fa7e89..43c21e4fa9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5ae4fa7e895f5d3a04514314b1af31b37469d274 +Subproject commit 43c21e4fa971739c448b4d6b07b00083b3a3aa2f diff --git a/platformio/__init__.py b/platformio/__init__.py index ccdc412801..55313ba94b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -17,15 +17,11 @@ __title__ = "platformio" __description__ = ( - "A professional collaborative platform for embedded development. " - "Cross-platform IDE and Unified Debugger. " - "Static Code Analyzer and Remote Unit Testing. " - "Multi-platform and Multi-architecture Build System. " - "Firmware File Explorer and Memory Inspection. " - "IoT, Arduino, CMSIS, ESP-IDF, FreeRTOS, libOpenCM3, mbedOS, Pulp OS, SPL, " - "STM32Cube, Zephyr RTOS, ARM, AVR, Espressif (ESP8266/ESP32), FPGA, " - "MCS-51 (8051), MSP430, Nordic (nRF51/nRF52), NXP i.MX RT, PIC32, RISC-V, " - "STMicroelectronics (STM8/STM32), Teensy" + "Your Gateway to Embedded Software Development Excellence. " + "Unlock the true potential of embedded software development " + "with PlatformIO's collaborative ecosystem, embracing " + "declarative principles, test-driven methodologies, and " + "modern toolchains for unrivaled success." ) __url__ = "https://platformio.org" From 6e75dc0d577ad3f49990f7e423631b4a6ff91a2b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 Aug 2023 12:46:19 +0300 Subject: [PATCH 33/34] Remove unnecessary files --- .../integration/tpls/clion/.gitignore.tpl | 2 - .../integration/tpls/clion/CMakeLists.txt.tpl | 33 ----- .../tpls/clion/CMakeListsPrivate.txt.tpl | 127 ------------------ 3 files changed, 162 deletions(-) delete mode 100644 platformio/project/integration/tpls/clion/CMakeLists.txt.tpl delete mode 100644 platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl diff --git a/platformio/project/integration/tpls/clion/.gitignore.tpl b/platformio/project/integration/tpls/clion/.gitignore.tpl index 3fe18ad479..03f4a3c192 100644 --- a/platformio/project/integration/tpls/clion/.gitignore.tpl +++ b/platformio/project/integration/tpls/clion/.gitignore.tpl @@ -1,3 +1 @@ .pio -CMakeListsPrivate.txt -cmake-build-*/ diff --git a/platformio/project/integration/tpls/clion/CMakeLists.txt.tpl b/platformio/project/integration/tpls/clion/CMakeLists.txt.tpl deleted file mode 100644 index ca3099eefc..0000000000 --- a/platformio/project/integration/tpls/clion/CMakeLists.txt.tpl +++ /dev/null @@ -1,33 +0,0 @@ -# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE -# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags -# -# If you need to override existing CMake configuration or add extra, -# please create `CMakeListsUser.txt` in the root of project. -# The `CMakeListsUser.txt` will not be overwritten by PlatformIO. - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_C_COMPILER_WORKS 1) -set(CMAKE_CXX_COMPILER_WORKS 1) - -project("{{project_name}}" C CXX) - -include(CMakeListsPrivate.txt) - -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsUser.txt) -include(CMakeListsUser.txt) -endif() - -add_custom_target( - Production ALL - COMMAND platformio -c clion run "$<$>:-e${CMAKE_BUILD_TYPE}>" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - Debug ALL - COMMAND platformio -c clion debug "$<$>:-e${CMAKE_BUILD_TYPE}>" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_executable(Z_DUMMY_TARGET ${SRC_LIST}) diff --git a/platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl deleted file mode 100644 index c65848f6b9..0000000000 --- a/platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl +++ /dev/null @@ -1,127 +0,0 @@ -# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE -# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags -# -# If you need to override existing CMake configuration or add extra, -# please create `CMakeListsUser.txt` in the root of project. -# The `CMakeListsUser.txt` will not be overwritten by PlatformIO. - -% import os -% import re -% -% from platformio.compat import shlex_join -% from platformio.project.helpers import load_build_metadata -% -% def _normalize_path(path): -% if project_dir in path: -% path = path.replace(project_dir, "${CMAKE_CURRENT_LIST_DIR}") -% elif user_home_dir in path: -% if "windows" in systype: -% path = path.replace(user_home_dir, "${ENV_HOME_PATH}") -% else: -% path = path.replace(user_home_dir, "$ENV{HOME}") -% end -% end -% return path -% end -% -% def _fix_lib_dirs(lib_dirs): -% result = [] -% for lib_dir in lib_dirs: -% if not os.path.isabs(lib_dir): -% lib_dir = os.path.join(project_dir, lib_dir) -% end -% result.append(to_unix_path(os.path.normpath(lib_dir))) -% end -% return result -% end -% -% def _escape(text): -% return to_unix_path(text).replace('"', '\\"') -% end -% -% def _get_lib_dirs(envname): -% env_libdeps_dir = os.path.join(config.get("platformio", "libdeps_dir"), envname) -% env_lib_extra_dirs = config.get("env:" + envname, "lib_extra_dirs", []) -% return _fix_lib_dirs([env_libdeps_dir] + env_lib_extra_dirs) -% end -% -% envs = config.envs() - - -% if len(envs) > 1: -set(CMAKE_CONFIGURATION_TYPES "{{ ";".join(envs) }};" CACHE STRING "Build Types reflect PlatformIO Environments" FORCE) -% else: -set(CMAKE_CONFIGURATION_TYPES "{{ env_name }}" CACHE STRING "Build Types reflect PlatformIO Environments" FORCE) -% end - -# Convert "Home Directory" that may contain unescaped backslashes on Windows -% if "windows" in systype: -file(TO_CMAKE_PATH $ENV{HOMEDRIVE}$ENV{HOMEPATH} ENV_HOME_PATH) -% end - -% if svd_path: -set(CLION_SVD_FILE_PATH "{{ _normalize_path(svd_path) }}" CACHE FILEPATH "Peripheral Registers Definitions File" FORCE) -% end - -SET(CMAKE_C_COMPILER "{{ _normalize_path(cc_path) }}") -SET(CMAKE_CXX_COMPILER "{{ _normalize_path(cxx_path) }}") -SET(CMAKE_CXX_FLAGS {{ _normalize_path(to_unix_path(shlex_join(cxx_flags))) }}) -SET(CMAKE_C_FLAGS {{ _normalize_path(to_unix_path(shlex_join(cc_flags))) }}) - -% cc_stds = [arg for arg in cc_flags if arg.startswith("-std=")] -% cxx_stds = [arg for arg in cxx_flags if arg.startswith("-std=")] -% if cc_stds: -SET(CMAKE_C_STANDARD {{ cc_stds[-1][-2:] }}) -% end -% if cxx_stds: -set(CMAKE_CXX_STANDARD {{ cxx_stds[-1][-2:] }}) -% end - -if (CMAKE_BUILD_TYPE MATCHES "{{ env_name }}") -% for define in defines: - add_definitions(-D{{!re.sub(r"([\"\(\)\ #])", r"\\\1", define)}}) -% end - -% for include in filter_includes(includes): - include_directories("{{ _normalize_path(include) }}") -% end - - FILE(GLOB_RECURSE EXTRA_LIB_SOURCES -% for dir in _get_lib_dirs(env_name): - {{ _normalize_path(dir) + "/*.*" }} -% end - ) -endif() - -% leftover_envs = list(set(envs) ^ set([env_name])) -% -% ide_data = {} -% if leftover_envs: -% ide_data = load_build_metadata(project_dir, leftover_envs) -% end -% -% 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)}}) -% end - -% for include in filter_includes(data["includes"]): - include_directories("{{ _normalize_path(to_unix_path(include)) }}") -% end - - FILE(GLOB_RECURSE EXTRA_LIB_SOURCES -% for dir in _get_lib_dirs(env): - {{ _normalize_path(dir) + "/*.*" }} -% end - ) -endif() -% end - -FILE(GLOB_RECURSE SRC_LIST -% for path in (project_src_dir, project_lib_dir, project_test_dir): - {{ _normalize_path(path) + "/*.*" }} -% end -) - -list(APPEND SRC_LIST ${EXTRA_LIB_SOURCES}) From 8b6a4b8ce8d26598321b842a68d0861e56dccd94 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 11 Aug 2023 13:18:41 +0300 Subject: [PATCH 34/34] Bump version to 6.1.10 --- HISTORY.rst | 2 +- docs | 2 +- platformio/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f6681b5446..882860c3d2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,7 +17,7 @@ Unlock the true potential of embedded software development with PlatformIO's collaborative ecosystem, embracing declarative principles, test-driven methodologies, and modern toolchains for unrivaled success. -6.1.10 (2023-??-??) +6.1.10 (2023-08-11) ~~~~~~~~~~~~~~~~~~~ * Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode `__ to break when the ``-iprefix`` compiler flag was used diff --git a/docs b/docs index 43c21e4fa9..295991a9c2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 43c21e4fa971739c448b4d6b07b00083b3a3aa2f +Subproject commit 295991a9c228ab9b1509fbaf41c30d4df7fec553 diff --git a/platformio/__init__.py b/platformio/__init__.py index 55313ba94b..b07d2bdc8d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (6, 1, "10b1") +VERSION = (6, 1, 10) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"