From 1fe806269db21bd44cd247097749423ec0110cef Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 12 Jan 2024 12:53:51 +0200 Subject: [PATCH 01/39] Start 6.1.14a1 --- HISTORY.rst | 3 +++ platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index f26bad63d0..63772de061 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,9 @@ 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.14 (2024-??-??) +~~~~~~~~~~~~~~~~~~~ + 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 7024104f67..81161c065a 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, 13) +VERSION = (6, 1, "14a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From adf4012b96417c3e6c3f881ca86ba734d3b1fdce Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 17 Jan 2024 12:43:57 +0200 Subject: [PATCH 02/39] Update deps --- platformio/pipdeps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index 677d8c9db5..31715be276 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -36,7 +36,7 @@ def get_pip_dependencies(): # PIO Home requirements "ajsonrpc == 1.2.*", "starlette >=0.19, <0.36", - "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.26"), + "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.27"), "wsproto == 1.*", ] From a75da327d03ebfb50f4ecffa0f7d895c2d38cc1e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 17 Jan 2024 12:45:33 +0200 Subject: [PATCH 03/39] Broadened version support for the `pyelftools` dependency // Resolve #4834 --- HISTORY.rst | 2 ++ platformio/pipdeps.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 63772de061..727cbe4622 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,8 @@ test-driven methodologies, and modern toolchains for unrivaled success. 6.1.14 (2024-??-??) ~~~~~~~~~~~~~~~~~~~ +* Broadened version support for the pyelftools dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) + 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index 31715be276..0ece2b6586 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -25,7 +25,7 @@ def get_pip_dependencies(): "click >=8.0.4, <9", "colorama", "marshmallow == 3.*", - "pyelftools == 0.30", + "pyelftools >=0.27, <1", "pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py" "requests%s == 2.*" % ("[socks]" if is_proxy_set(socks=True) else ""), "semantic_version == 2.10.*", From 28c90652bc527c7f76be7d40803b1c5814946972 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 22 Jan 2024 22:51:23 +0200 Subject: [PATCH 04/39] Update deps --- platformio/pipdeps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index 0ece2b6586..771290c1c1 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -35,8 +35,8 @@ def get_pip_dependencies(): home = [ # PIO Home requirements "ajsonrpc == 1.2.*", - "starlette >=0.19, <0.36", - "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.27"), + "starlette >=0.19, <0.37", + "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.28"), "wsproto == 1.*", ] From 84c7ede0e102857c0edb852c0572514aa637883b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 22 Jan 2024 22:54:58 +0200 Subject: [PATCH 05/39] Sync docs --- docs | 2 +- platformio/pipdeps.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 3f02152561..64a2a3b6da 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3f02152561334a92bd8cae5c49e35cc194f86721 +Subproject commit 64a2a3b6dabd084b64a832fb35f6d3669adaf506 diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index 771290c1c1..f41218ea22 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -35,7 +35,7 @@ def get_pip_dependencies(): home = [ # PIO Home requirements "ajsonrpc == 1.2.*", - "starlette >=0.19, <0.37", + "starlette >=0.19, <0.36", "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.28"), "wsproto == 1.*", ] From e3e08d96916cdbac22d5a465bbd752408ae25a6a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 22 Jan 2024 22:57:07 +0200 Subject: [PATCH 06/39] Resolved an issue related to the relative package path in the `pio pkg publish` --- HISTORY.rst | 3 ++- platformio/package/commands/publish.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 727cbe4622..bfe1dcbae4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,7 +20,8 @@ test-driven methodologies, and modern toolchains for unrivaled success. 6.1.14 (2024-??-??) ~~~~~~~~~~~~~~~~~~~ -* Broadened version support for the pyelftools dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) +* Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) +* Resolved an issue related to the relative package path in the `pio pkg publish `__ command 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/package/commands/publish.py b/platformio/package/commands/publish.py index c8b4ea7774..ff0f6507b0 100644 --- a/platformio/package/commands/publish.py +++ b/platformio/package/commands/publish.py @@ -86,6 +86,7 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals package, owner, typex, released_at, private, notify, no_interactive, non_interactive ): click.secho("Preparing a package...", fg="cyan") + package = os.path.abspath(package) no_interactive = no_interactive or non_interactive owner = owner or AccountClient().get_logged_username() do_not_pack = ( From adf94843eaf48ae3722f5740f5b2990c182de1b8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Jan 2024 14:01:42 +0200 Subject: [PATCH 07/39] Apply formatting --- platformio/account/team/commands/list.py | 12 +++++++----- platformio/builder/tools/pioplatform.py | 8 +++++--- platformio/check/cli.py | 16 ++++++++++------ platformio/debug/config/base.py | 8 +++++--- platformio/device/list/util.py | 6 +++--- platformio/device/monitor/command.py | 8 +++++--- platformio/home/rpc/handlers/project.py | 16 ++++++++++------ platformio/http.py | 8 +++++--- platformio/package/commands/install.py | 8 +++++--- platformio/package/commands/search.py | 10 ++++++---- platformio/package/manager/_install.py | 6 +++--- platformio/package/manifest/parser.py | 8 +++++--- platformio/package/meta.py | 8 +++++--- platformio/platform/_run.py | 6 +++--- platformio/project/commands/config.py | 8 +++++--- platformio/project/integration/generator.py | 8 +++++--- platformio/registry/access/commands/list.py | 8 +++++--- platformio/registry/mirror.py | 8 +++++--- platformio/remote/client/device_monitor.py | 8 +++++--- platformio/test/reports/json.py | 12 +++++++----- 20 files changed, 109 insertions(+), 71 deletions(-) diff --git a/platformio/account/team/commands/list.py b/platformio/account/team/commands/list.py index d0395d7c20..5bdc8c1446 100644 --- a/platformio/account/team/commands/list.py +++ b/platformio/account/team/commands/list.py @@ -48,11 +48,13 @@ def team_list_cmd(orgname, json_output): table_data.append( ( "Members:", - ", ".join( - (member.get("username") for member in team.get("members")) - ) - if team.get("members") - else "-", + ( + ", ".join( + (member.get("username") for member in team.get("members")) + ) + if team.get("members") + else "-" + ), ) ) click.echo(tabulate(table_data, tablefmt="plain")) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 4ce4b91d59..f99a6ec5a8 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -75,9 +75,11 @@ def LoadPioPlatform(env): continue env.PrependENVPath( "PATH", - os.path.join(pkg.path, "bin") - if os.path.isdir(os.path.join(pkg.path, "bin")) - else pkg.path, + ( + os.path.join(pkg.path, "bin") + if os.path.isdir(os.path.join(pkg.path, "bin")) + else pkg.path + ), ) if ( not IS_WINDOWS diff --git a/platformio/check/cli.py b/platformio/check/cli.py index 1deced8766..3e0c175996 100644 --- a/platformio/check/cli.py +++ b/platformio/check/cli.py @@ -122,9 +122,11 @@ def cli( silent=silent, src_filters=env_src_filters, flags=flags or env_options.get("check_flags"), - severity=[DefectItem.SEVERITY_LABELS[DefectItem.SEVERITY_HIGH]] - if silent - else severity or config.get("env:" + envname, "check_severity"), + severity=( + [DefectItem.SEVERITY_LABELS[DefectItem.SEVERITY_HIGH]] + if silent + else severity or config.get("env:" + envname, "check_severity") + ), skip_packages=skip_packages or env_options.get("check_skip_packages"), platform_packages=env_options.get("platform_packages"), ) @@ -142,9 +144,11 @@ def cli( result = {"env": envname, "tool": tool, "duration": time()} rc = ct.check( - on_defect_callback=None - if (json_output or verbose) - else lambda defect: click.echo(repr(defect)) + on_defect_callback=( + None + if (json_output or verbose) + else lambda defect: click.echo(repr(defect)) + ) ) result["defects"] = ct.get_defects() diff --git a/platformio/debug/config/base.py b/platformio/debug/config/base.py index 212d00fa2b..2a9f22354b 100644 --- a/platformio/debug/config/base.py +++ b/platformio/debug/config/base.py @@ -194,9 +194,11 @@ def _configure_server(self): cwd=server_package_dir if server_package else None, executable=result.get("executable"), arguments=[ - a.replace("$PACKAGE_DIR", server_package_dir) - if server_package_dir - else a + ( + a.replace("$PACKAGE_DIR", server_package_dir) + if server_package_dir + else a + ) for a in result.get("arguments", []) ], ) diff --git a/platformio/device/list/util.py b/platformio/device/list/util.py index 3589ee2666..3847969c43 100644 --- a/platformio/device/list/util.py +++ b/platformio/device/list/util.py @@ -144,9 +144,9 @@ def get_services(self): if service.properties: try: properties = { - k.decode("utf8"): v.decode("utf8") - if isinstance(v, bytes) - else v + k.decode("utf8"): ( + v.decode("utf8") if isinstance(v, bytes) else v + ) for k, v in service.properties.items() } json.dumps(properties) diff --git a/platformio/device/monitor/command.py b/platformio/device/monitor/command.py index 3d3190fe48..87f6444929 100644 --- a/platformio/device/monitor/command.py +++ b/platformio/device/monitor/command.py @@ -125,9 +125,11 @@ def device_monitor_cmd(**options): options = apply_project_monitor_options(options, project_options) register_filters(platform=platform, options=options) options["port"] = SerialPortFinder( - board_config=platform.board_config(project_options.get("board")) - if platform and project_options.get("board") - else None, + board_config=( + platform.board_config(project_options.get("board")) + if platform and project_options.get("board") + else None + ), upload_protocol=project_options.get("upload_protocol"), ensure_ready=True, ).find(initial_port=options["port"]) diff --git a/platformio/home/rpc/handlers/project.py b/platformio/home/rpc/handlers/project.py index 2c03a7c980..817bb21058 100644 --- a/platformio/home/rpc/handlers/project.py +++ b/platformio/home/rpc/handlers/project.py @@ -372,15 +372,19 @@ def configuration(project_dir, env): return dict( platform=dict( - ownername=platform_pkg.metadata.spec.owner - if platform_pkg.metadata.spec - else None, + 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, + board=( + platform.board_config(board_id).get_brief_data() + if board_id + else None + ), frameworks=frameworks or None, ) diff --git a/platformio/http.py b/platformio/http.py index 563f982fb9..18bb50c625 100644 --- a/platformio/http.py +++ b/platformio/http.py @@ -63,9 +63,11 @@ def request( # pylint: disable=signature-differs,arguments-differ kwargs["timeout"] = __default_requests_timeout__ return super().request( method, - url - if url.startswith("http") or not self._x_base_url - else urljoin(self._x_base_url, url), + ( + url + if url.startswith("http") or not self._x_base_url + else urljoin(self._x_base_url, url) + ), *args, **kwargs ) diff --git a/platformio/package/commands/install.py b/platformio/package/commands/install.py index d297664408..8c987c1718 100644 --- a/platformio/package/commands/install.py +++ b/platformio/package/commands/install.py @@ -222,9 +222,11 @@ def _install_project_env_libraries(project_env, options): env_lm = LibraryPackageManager( os.path.join(config.get("platformio", "libdeps_dir"), project_env), - compatibility=PackageCompatibility(**compatibility_qualifiers) - if compatibility_qualifiers - else None, + compatibility=( + PackageCompatibility(**compatibility_qualifiers) + if compatibility_qualifiers + else None + ), ) private_lm = LibraryPackageManager( os.path.join(config.get("platformio", "lib_dir")) diff --git a/platformio/package/commands/search.py b/platformio/package/commands/search.py index ac71ef4ca2..c3f7d5cd11 100644 --- a/platformio/package/commands/search.py +++ b/platformio/package/commands/search.py @@ -65,10 +65,12 @@ def print_search_item(item): click.echo( "%s • %s • Published on %s" % ( - item["type"].capitalize() - if item["tier"] == "community" - else click.style( - ("%s %s" % (item["tier"], item["type"])).title(), bold=True + ( + item["type"].capitalize() + if item["tier"] == "community" + else click.style( + ("%s %s" % (item["tier"], item["type"])).title(), bold=True + ) ), item["version"]["name"], util.parse_datetime(item["version"]["released_at"]).strftime("%c"), diff --git a/platformio/package/manager/_install.py b/platformio/package/manager/_install.py index fc4d5ddbc6..125766d3d0 100644 --- a/platformio/package/manager/_install.py +++ b/platformio/package/manager/_install.py @@ -98,9 +98,9 @@ def _install( else: pkg = self.install_from_registry( spec, - search_qualifiers=compatibility.to_search_qualifiers() - if compatibility - else None, + search_qualifiers=( + compatibility.to_search_qualifiers() if compatibility else None + ), ) if not pkg or not pkg.metadata: diff --git a/platformio/package/manifest/parser.py b/platformio/package/manifest/parser.py index d3fe6bfa42..7694c8a859 100644 --- a/platformio/package/manifest/parser.py +++ b/platformio/package/manifest/parser.py @@ -294,9 +294,11 @@ def parse_examples_from_dir(package_dir): if not matched_files: continue result[root] = dict( - name="Examples" - if root == examples_dir - else os.path.relpath(root, examples_dir), + name=( + "Examples" + if root == examples_dir + else os.path.relpath(root, examples_dir) + ), base=os.path.relpath(root, package_dir), files=matched_files, ) diff --git a/platformio/package/meta.py b/platformio/package/meta.py index b1c491d784..b9e3750dd8 100644 --- a/platformio/package/meta.py +++ b/platformio/package/meta.py @@ -485,9 +485,11 @@ def __repr__(self): def __eq__(self, other): conds = [ - os.path.realpath(self.path) == os.path.realpath(other.path) - if self.path and other.path - else self.path == other.path, + ( + os.path.realpath(self.path) == os.path.realpath(other.path) + if self.path and other.path + else self.path == other.path + ), self.metadata == other.metadata, ] return all(conds) diff --git a/platformio/platform/_run.py b/platformio/platform/_run.py index 949a452da5..2912371dc9 100644 --- a/platformio/platform/_run.py +++ b/platformio/platform/_run.py @@ -116,9 +116,9 @@ def _write_and_flush(stream, data): args, stdout=proc.BuildAsyncPipe( line_callback=self._on_stdout_line, - data_callback=lambda data: None - if self.silent - else _write_and_flush(sys.stdout, data), + data_callback=lambda data: ( + None if self.silent else _write_and_flush(sys.stdout, data) + ), ), stderr=proc.BuildAsyncPipe( line_callback=self._on_stderr_line, diff --git a/platformio/project/commands/config.py b/platformio/project/commands/config.py index 5e4ed21fd6..214b0db145 100644 --- a/platformio/project/commands/config.py +++ b/platformio/project/commands/config.py @@ -82,9 +82,11 @@ def lint_configuration(json_output=False): ( click.style(error["type"], fg="red"), error["message"], - error.get("source", "") + (f":{error.get('lineno')}") - if "lineno" in error - else "", + ( + error.get("source", "") + (f":{error.get('lineno')}") + if "lineno" in error + else "" + ), ) for error in errors ], diff --git a/platformio/project/integration/generator.py b/platformio/project/integration/generator.py index d55f9aa7dc..3cb677f14f 100644 --- a/platformio/project/integration/generator.py +++ b/platformio/project/integration/generator.py @@ -91,9 +91,11 @@ def _load_tplvars(self): "default_debug_env_name": get_default_debug_env(self.config), "env_name": self.env_name, "user_home_dir": os.path.abspath(fs.expanduser("~")), - "platformio_path": sys.argv[0] - if os.path.isfile(sys.argv[0]) - else where_is_program("platformio"), + "platformio_path": ( + sys.argv[0] + if os.path.isfile(sys.argv[0]) + else where_is_program("platformio") + ), "env_path": os.getenv("PATH"), "env_pathsep": os.pathsep, } diff --git a/platformio/registry/access/commands/list.py b/platformio/registry/access/commands/list.py index ce9d8a6a86..5007303143 100644 --- a/platformio/registry/access/commands/list.py +++ b/platformio/registry/access/commands/list.py @@ -41,9 +41,11 @@ def access_list_cmd(owner, urn_type, json_output): # pylint: disable=unused-arg table_data.append( ( "Access:", - click.style("Private", fg="red") - if resource.get("private", False) - else "Public", + ( + click.style("Private", fg="red") + if resource.get("private", False) + else "Public" + ), ) ) table_data.append( diff --git a/platformio/registry/mirror.py b/platformio/registry/mirror.py index 4b4508f662..8805ffe543 100644 --- a/platformio/registry/mirror.py +++ b/platformio/registry/mirror.py @@ -54,9 +54,11 @@ def __next__(self): "head", self._url_parts.path, allow_redirects=False, - params=dict(bypass=",".join(self._visited_mirrors)) - if self._visited_mirrors - else None, + params=( + dict(bypass=",".join(self._visited_mirrors)) + if self._visited_mirrors + else None + ), x_with_authorization=RegistryClient.allowed_private_packages(), ) stop_conditions = [ diff --git a/platformio/remote/client/device_monitor.py b/platformio/remote/client/device_monitor.py index 1499dd5866..4e1ccb2fec 100644 --- a/platformio/remote/client/device_monitor.py +++ b/platformio/remote/client/device_monitor.py @@ -123,9 +123,11 @@ def _cb_device_list(self, result): index=i + 1, host=device[0] + ":" if len(result) > 1 else "", port=device[1]["port"], - description=device[1]["description"] - if device[1]["description"] != "n/a" - else "", + description=( + device[1]["description"] + if device[1]["description"] != "n/a" + else "" + ), ) ) device_index = click.prompt( diff --git a/platformio/test/reports/json.py b/platformio/test/reports/json.py index 791224c70f..3d3c6f6e4e 100644 --- a/platformio/test/reports/json.py +++ b/platformio/test/reports/json.py @@ -62,11 +62,13 @@ def test_suite_to_json(self, test_suite): test_dir=test_suite.test_dir, status=test_suite.status.name, duration=test_suite.duration, - timestamp=datetime.datetime.fromtimestamp(test_suite.timestamp).strftime( - "%Y-%m-%dT%H:%M:%S" - ) - if test_suite.timestamp - else None, + timestamp=( + datetime.datetime.fromtimestamp(test_suite.timestamp).strftime( + "%Y-%m-%dT%H:%M:%S" + ) + if test_suite.timestamp + else None + ), testcase_nums=len(test_suite.cases), error_nums=test_suite.get_status_nums(TestStatus.ERRORED), failure_nums=test_suite.get_status_nums(TestStatus.FAILED), From 255e91b51c7076c322a748c746a5fa63ceae6ae8 Mon Sep 17 00:00:00 2001 From: Song Yadong Date: Mon, 29 Jan 2024 14:54:18 +0800 Subject: [PATCH 08/39] fix a typo (#4845) --- platformio/project/commands/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/project/commands/init.py b/platformio/project/commands/init.py index 51ae46a48d..4dae6e5888 100644 --- a/platformio/project/commands/init.py +++ b/platformio/project/commands/init.py @@ -223,7 +223,7 @@ def init_lib_readme(lib_dir): This directory is intended for project specific (private) libraries. PlatformIO will compile them to static libraries and link into executable file. -The source code of each library should be placed in a an own separate directory +The source code of each library should be placed in an own separate directory ("lib/your_library_name/[here are source files]"). For example, see a structure of the following two libraries `Foo` and `Bar`: From 3e9ca48588abd2ca64df190c870bb1240089a30b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Feb 2024 13:35:50 +0200 Subject: [PATCH 09/39] Update deps --- platformio/pipdeps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index f41218ea22..e619341343 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -35,7 +35,7 @@ def get_pip_dependencies(): home = [ # PIO Home requirements "ajsonrpc == 1.2.*", - "starlette >=0.19, <0.36", + "starlette >=0.19, <0.38", "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.28"), "wsproto == 1.*", ] From 353f4403355b3c0f3e2e230697e1da487736d26d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Feb 2024 13:36:21 +0200 Subject: [PATCH 10/39] Addressed an issue where passing a relative path to the `pio project init` // Resolve #4847 --- HISTORY.rst | 1 + platformio/project/commands/init.py | 1 + tests/commands/test_init.py | 42 +++++++++++++++-------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index bfe1dcbae4..4f1cc2d309 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command +* Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/project/commands/init.py b/platformio/project/commands/init.py index 4dae6e5888..bc3ac61a8e 100644 --- a/platformio/project/commands/init.py +++ b/platformio/project/commands/init.py @@ -79,6 +79,7 @@ def project_init_cmd( env_prefix, silent, ): + project_dir = os.path.abspath(project_dir) is_new_project = not is_platformio_project(project_dir) if is_new_project: if not silent: diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py index 651cf579f5..a8bffc5d6e 100644 --- a/tests/commands/test_init.py +++ b/tests/commands/test_init.py @@ -15,6 +15,7 @@ import json import os +from platformio import fs from platformio.commands.boards import cli as cmd_boards from platformio.project.commands.init import project_init_cmd from platformio.project.config import ProjectConfig @@ -36,27 +37,28 @@ def test_init_default(clirunner, validate_cliresult): validate_pioproject(os.getcwd()) -def test_init_ext_folder(clirunner, validate_cliresult): - with clirunner.isolated_filesystem(): - ext_folder_name = "ext_folder" - os.makedirs(ext_folder_name) - result = clirunner.invoke(project_init_cmd, ["-d", ext_folder_name]) - validate_cliresult(result) - validate_pioproject(os.path.join(os.getcwd(), ext_folder_name)) - - def test_init_duplicated_boards(clirunner, validate_cliresult, tmpdir): - with tmpdir.as_cwd(): - for _ in range(2): - result = clirunner.invoke( - project_init_cmd, - ["-b", "uno", "-b", "uno", "--no-install-dependencies"], - ) - validate_cliresult(result) - validate_pioproject(str(tmpdir)) - config = ProjectConfig(os.path.join(os.getcwd(), "platformio.ini")) - config.validate() - assert set(config.sections()) == set(["env:uno"]) + project_dir = str(tmpdir.join("ext_folder")) + os.makedirs(project_dir) + + with fs.cd(os.path.dirname(project_dir)): + result = clirunner.invoke( + project_init_cmd, + [ + "-d", + os.path.basename(project_dir), + "-b", + "uno", + "-b", + "uno", + "--no-install-dependencies", + ], + ) + validate_cliresult(result) + validate_pioproject(project_dir) + config = ProjectConfig(os.path.join(project_dir, "platformio.ini")) + config.validate() + assert set(config.sections()) == set(["env:uno"]) def test_init_ide_without_board(clirunner, tmpdir): From 80fc33552827dcc977fde5da45d556ce16b6f0e4 Mon Sep 17 00:00:00 2001 From: Levente Farkas Date: Wed, 7 Feb 2024 12:42:49 +0100 Subject: [PATCH 11/39] add LuatOS ESP32-C3 Development Board (#4852) --- platformio/assets/system/99-platformio-udev.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio/assets/system/99-platformio-udev.rules b/platformio/assets/system/99-platformio-udev.rules index 992676db37..bc31ac741c 100644 --- a/platformio/assets/system/99-platformio-udev.rules +++ b/platformio/assets/system/99-platformio-udev.rules @@ -36,6 +36,8 @@ ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666", ENV{ID_MM_DEVIC # QinHeng Electronics HL-340 USB-Serial adapter ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +# QinHeng Electronics CH343 USB-Serial adapter +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d3", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" # QinHeng Electronics CH9102 USB-Serial adapter ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" @@ -173,4 +175,4 @@ ATTRS{product}=="*CMSIS-DAP*", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" # Espressif USB JTAG/serial debug unit -ATTRS{idVendor}=="303a", ATTR{idProduct}=="1001", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" \ No newline at end of file +ATTRS{idVendor}=="303a", ATTR{idProduct}=="1001", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" From f4319f670cdb56423f0e841a470cb116364b1fdc Mon Sep 17 00:00:00 2001 From: newmansnj <110606942+newmansnj@users.noreply.github.com> Date: Fri, 9 Feb 2024 07:20:40 +0100 Subject: [PATCH 12/39] Update piomaxlen.py change from 8192 to 8191 MAX_LINE_LENGTH (#4856) The maximum length of the string that you can use at the command prompt is 8191 characters. This limitation applies to: the command line individual environment variables that are inherited by other processes, such as the PATH variable all environment variable expansions If you use Command Prompt to run batch files, this limitation also applies to batch file processing. https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation#:~:text=The%20maximum%20length%20of%20the,such%20as%20the%20PATH%20variable --- platformio/builder/tools/piomaxlen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/builder/tools/piomaxlen.py b/platformio/builder/tools/piomaxlen.py index d20879eb9b..8d45317cc2 100644 --- a/platformio/builder/tools/piomaxlen.py +++ b/platformio/builder/tools/piomaxlen.py @@ -23,10 +23,10 @@ from platformio.compat import IS_WINDOWS, hashlib_encode_data # There are the next limits depending on a platform: -# - Windows = 8192 +# - Windows = 8191 # - Unix = 131072 # We need ~512 characters for compiler and temporary file paths -MAX_LINE_LENGTH = (8192 if IS_WINDOWS else 131072) - 512 +MAX_LINE_LENGTH = (8191 if IS_WINDOWS else 131072) - 512 WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)") From f519a9d5248df3c50b0351b314cf5b090f0893b4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Feb 2024 11:34:12 +0200 Subject: [PATCH 13/39] Update SPDX to 3.23 --- docs | 2 +- platformio/package/manifest/schema.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 64a2a3b6da..62cd4c75f1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 64a2a3b6dabd084b64a832fb35f6d3669adaf506 +Subproject commit 62cd4c75f12bd27bff3aa60547208f32dfdacc3a diff --git a/platformio/package/manifest/schema.py b/platformio/package/manifest/schema.py index eeffd83e7b..c1d22ab59b 100644 --- a/platformio/package/manifest/schema.py +++ b/platformio/package/manifest/schema.py @@ -276,7 +276,7 @@ def validate_license(self, value): @staticmethod @memoized(expire="1h") def load_spdx_licenses(): - version = "3.22" + version = "3.23" spdx_data_url = ( "https://raw.githubusercontent.com/spdx/license-list-data/" f"v{version}/json/licenses.json" From 55be7181b3aa452cdfe5c8522cd886584567ad4f Mon Sep 17 00:00:00 2001 From: Jakob <78532991+jake-is-ESD-protected@users.noreply.github.com> Date: Sat, 10 Feb 2024 21:21:49 +0100 Subject: [PATCH 14/39] Add STM32 virtual COM port to `udev.rules` (#4773) * add Espressif USB JTAG/serial debug unit to udev * add STM32 virtual COM port --- platformio/assets/system/99-platformio-udev.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platformio/assets/system/99-platformio-udev.rules b/platformio/assets/system/99-platformio-udev.rules index bc31ac741c..d17569e758 100644 --- a/platformio/assets/system/99-platformio-udev.rules +++ b/platformio/assets/system/99-platformio-udev.rules @@ -87,6 +87,8 @@ ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="[01]*", MODE:="0666", ENV{ID_MM_DEVI # AIR32F103 ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +# STM32 virtual COM port +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" # # Debuggers From 2239616484295e8835c317b3211801b72c46156e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2024 19:01:20 +0200 Subject: [PATCH 15/39] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 62cd4c75f1..09232d5768 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 62cd4c75f12bd27bff3aa60547208f32dfdacc3a +Subproject commit 09232d5768dcbbf87e3c8713575e200ae3ae6522 From e1ff9a469d339b0fc4689a5e1520a89f14556a77 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2024 19:32:57 +0200 Subject: [PATCH 16/39] Resolved an issue where the LDF selected an incorrect library version // Resolve #4860 --- HISTORY.rst | 3 +- platformio/builder/tools/piolib.py | 17 ++++++++-- platformio/package/manager/_install.py | 6 +++- platformio/package/meta.py | 45 ++++++++++++++++++++++---- 4 files changed, 60 insertions(+), 11 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4f1cc2d309..9b6c8e0b73 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,8 +21,9 @@ test-driven methodologies, and modern toolchains for unrivaled success. ~~~~~~~~~~~~~~~~~~~ * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) -* Resolved an issue related to the relative package path in the `pio pkg publish `__ command * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) +* Resolved an issue related to the relative package path in the `pio pkg publish `__ command +* Resolved an issue where the |LDF| selected an incorrect library version (`issue #4860 `_) 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index aa18cd1a01..b6ba8d84c0 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -309,10 +309,10 @@ def process_dependencies(self): if not self.dependencies or self._deps_are_processed: return self._deps_are_processed = True - for item in self.dependencies: + for dependency in self.dependencies: found = False for lb in self.env.GetLibBuilders(): - if item["name"] != lb.name: + if not lb.is_dependency_compatible(dependency): continue found = True if lb not in self.depbuilders: @@ -322,9 +322,20 @@ def process_dependencies(self): if not found and self.verbose: sys.stderr.write( "Warning: Ignored `%s` dependency for `%s` " - "library\n" % (item["name"], self.name) + "library\n" % (dependency["name"], self.name) ) + def is_dependency_compatible(self, dependency): + pkg = PackageItem(self.path) + qualifiers = {"name": self.name, "version": self.version} + if pkg.metadata: + qualifiers = {"name": pkg.metadata.name, "version": pkg.metadata.version} + if pkg.metadata.spec and pkg.metadata.spec.owner: + qualifiers["owner"] = pkg.metadata.spec.owner + return PackageCompatibility.from_dependency(dependency).is_compatible( + PackageCompatibility(**qualifiers) + ) + def get_search_files(self): return [ os.path.join(self.src_dir, item) diff --git a/platformio/package/manager/_install.py b/platformio/package/manager/_install.py index 125766d3d0..12c116d1c8 100644 --- a/platformio/package/manager/_install.py +++ b/platformio/package/manager/_install.py @@ -99,7 +99,11 @@ def _install( pkg = self.install_from_registry( spec, search_qualifiers=( - compatibility.to_search_qualifiers() if compatibility else None + compatibility.to_search_qualifiers( + ["platforms", "frameworks", "authors"] + ) + if compatibility + else None ), ) diff --git a/platformio/package/meta.py b/platformio/package/meta.py index b9e3750dd8..7597148eed 100644 --- a/platformio/package/meta.py +++ b/platformio/package/meta.py @@ -65,7 +65,14 @@ def from_archive(cls, path): class PackageCompatibility: - KNOWN_QUALIFIERS = ("platforms", "frameworks", "authors") + KNOWN_QUALIFIERS = ( + "owner", + "name", + "version", + "platforms", + "frameworks", + "authors", + ) @classmethod def from_dependency(cls, dependency): @@ -89,19 +96,45 @@ def __init__(self, **kwargs): def __repr__(self): return "PackageCompatibility <%s>" % self.qualifiers - def to_search_qualifiers(self): - return self.qualifiers + def to_search_qualifiers(self, fields=None): + result = {} + for name, value in self.qualifiers.items(): + if not fields or name in fields: + result[name] = value + return result def is_compatible(self, other): assert isinstance(other, PackageCompatibility) - for key, value in self.qualifiers.items(): + for key, current_value in self.qualifiers.items(): other_value = other.qualifiers.get(key) - if not value or not other_value: + if not current_value or not other_value: + continue + if any(isinstance(v, list) for v in (current_value, other_value)): + if not items_in_list(current_value, other_value): + return False + continue + if key == "version": + if not self._compare_versions(current_value, other_value): + return False continue - if not items_in_list(value, other_value): + if current_value != other_value: return False return True + def _compare_versions(self, current, other): + if current == other: + return True + try: + version = ( + other + if isinstance(other, semantic_version.Version) + else cast_version_to_semver(other) + ) + return version in semantic_version.SimpleSpec(current) + except ValueError: + pass + return False + class PackageOutdatedResult: UPDATE_INCREMENT_MAJOR = "major" From c4f76848a7f8594e3b4f39991a45a71fca875329 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2024 22:47:22 +0200 Subject: [PATCH 17/39] Validate only owner/name/version fields --- platformio/builder/tools/piolib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index b6ba8d84c0..d970344e68 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -332,9 +332,9 @@ def is_dependency_compatible(self, dependency): qualifiers = {"name": pkg.metadata.name, "version": pkg.metadata.version} if pkg.metadata.spec and pkg.metadata.spec.owner: qualifiers["owner"] = pkg.metadata.spec.owner - return PackageCompatibility.from_dependency(dependency).is_compatible( - PackageCompatibility(**qualifiers) - ) + return PackageCompatibility.from_dependency( + {k: v for k, v in dependency.items() if k in ("owner", "name", "version")} + ).is_compatible(PackageCompatibility(**qualifiers)) def get_search_files(self): return [ From 042f8dc668ce50a23d6802b0fe6e37a048f993eb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2024 22:48:06 +0200 Subject: [PATCH 18/39] Bump version to 6.1.14a2 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 81161c065a..450b2996cb 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, "14a1") +VERSION = (6, 1, "14a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From aa06d21abeefb600f0c7e8d8dd100b3f8327bffb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 15 Feb 2024 22:28:09 +0200 Subject: [PATCH 19/39] Resolved an issue with the `hexlify` filter in the device monitor command // Resolve #4732 --- HISTORY.rst | 1 + docs | 2 +- platformio/device/monitor/command.py | 2 +- platformio/device/monitor/filters/base.py | 9 ++++++++- platformio/device/monitor/filters/hexlify.py | 10 ++++++++-- platformio/device/monitor/terminal.py | 6 ++++++ platformio/project/options.py | 2 +- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9b6c8e0b73..a905f8588e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -24,6 +24,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command * Resolved an issue where the |LDF| selected an incorrect library version (`issue #4860 `_) +* Resolved an issue with the ``hexlify`` filter in the `device monitor `__ command, ensuring proper representation of characters with Unicode code points higher than 127 (`issue #4732 `_) 6.1.13 (2024-01-12) ~~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index 09232d5768..37c10d2f72 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 09232d5768dcbbf87e3c8713575e200ae3ae6522 +Subproject commit 37c10d2f72c18d1b3f84db661e96fa7732d2c7ad diff --git a/platformio/device/monitor/command.py b/platformio/device/monitor/command.py index 87f6444929..b3dc0a0e5f 100644 --- a/platformio/device/monitor/command.py +++ b/platformio/device/monitor/command.py @@ -58,7 +58,7 @@ "--encoding", help=( "Set the encoding for the serial port " - "(e.g. hexlify, Latin1, UTF-8) [default=%s]" + "(e.g. hexlify, Latin-1, UTF-8) [default=%s]" % ProjectOptions["env.monitor_encoding"].default ), ) diff --git a/platformio/device/monitor/filters/base.py b/platformio/device/monitor/filters/base.py index e773ed655d..5a65f800df 100644 --- a/platformio/device/monitor/filters/base.py +++ b/platformio/device/monitor/filters/base.py @@ -25,11 +25,12 @@ class DeviceMonitorFilterBase(miniterm.Transform): def __init__(self, options=None): """Called by PlatformIO to pass context""" - miniterm.Transform.__init__(self) + super().__init__() self.options = options or {} self.project_dir = self.options.get("project_dir") self.environment = self.options.get("environment") + self._running_terminal = None self.config = ProjectConfig.get_instance() if not self.environment: @@ -47,6 +48,12 @@ def __call__(self): def NAME(self): raise NotImplementedError("Please declare NAME attribute for the filter class") + def set_running_terminal(self, terminal): + self._running_terminal = terminal + + def get_running_terminal(self): + return self._running_terminal + def register_filters(platform=None, options=None): # project filters diff --git a/platformio/device/monitor/filters/hexlify.py b/platformio/device/monitor/filters/hexlify.py index 28e83bfb8f..40fc203ed0 100644 --- a/platformio/device/monitor/filters/hexlify.py +++ b/platformio/device/monitor/filters/hexlify.py @@ -24,12 +24,18 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._counter = 0 + def set_running_terminal(self, terminal): + # force to Latin-1, issue #4732 + if terminal.input_encoding == "UTF-8": + terminal.set_rx_encoding("Latin-1") + super().set_running_terminal(terminal) + def rx(self, text): result = "" - for b in serial.iterbytes(text): + for c in serial.iterbytes(text): if (self._counter % 16) == 0: result += "\n{:04X} | ".format(self._counter) - asciicode = ord(b) + asciicode = ord(c) if asciicode <= 255: result += "{:02X} ".format(asciicode) else: diff --git a/platformio/device/monitor/terminal.py b/platformio/device/monitor/terminal.py index 7b2a9b91b9..a3abf857f1 100644 --- a/platformio/device/monitor/terminal.py +++ b/platformio/device/monitor/terminal.py @@ -110,6 +110,12 @@ def new_terminal(options): term.raw = options["raw"] term.set_rx_encoding(options["encoding"]) term.set_tx_encoding(options["encoding"]) + for ts in (term.tx_transformations, term.rx_transformations): + for t in ts: + try: + t.set_running_terminal(term) + except AttributeError: + pass return term diff --git a/platformio/project/options.py b/platformio/project/options.py index 51611d2478..3d9c896929 100644 --- a/platformio/project/options.py +++ b/platformio/project/options.py @@ -549,7 +549,7 @@ def get_default_core_dir(): ConfigEnvOption( group="monitor", name="monitor_encoding", - description="Custom encoding (e.g. hexlify, Latin1, UTF-8)", + description="Custom encoding (e.g. hexlify, Latin-1, UTF-8)", default="UTF-8", ), # Library From 7606dd4faf9ae73684043c5c07390af8e042fca1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 17:06:50 +0200 Subject: [PATCH 20/39] Minor improvements // Issue #4710 --- platformio/builder/tools/piobuild.py | 2 +- platformio/debug/config/base.py | 4 ++- platformio/project/helpers.py | 46 +++++++++++++++------------- platformio/test/runners/unity.py | 4 --- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/platformio/builder/tools/piobuild.py b/platformio/builder/tools/piobuild.py index 047090c75c..b3d650a5d7 100644 --- a/platformio/builder/tools/piobuild.py +++ b/platformio/builder/tools/piobuild.py @@ -54,7 +54,7 @@ def GetBuildType(env): modes.append("debug") if "__test" in COMMAND_LINE_TARGETS or env.GetProjectOption("build_type") == "test": modes.append("test") - return "+".join(modes or ["release"]) + return ", ".join(modes or ["release"]) def BuildProgram(env): diff --git a/platformio/debug/config/base.py b/platformio/debug/config/base.py index 2a9f22354b..1caae23f73 100644 --- a/platformio/debug/config/base.py +++ b/platformio/debug/config/base.py @@ -148,7 +148,9 @@ def server_ready_pattern(self): ) def _load_build_data(self): - data = load_build_metadata(os.getcwd(), self.env_name, cache=True, debug=True) + data = load_build_metadata( + os.getcwd(), self.env_name, cache=True, build_type="debug" + ) if not data: raise DebugInvalidOptionsError("Could not load a build configuration") return data diff --git a/platformio/project/helpers.py b/platformio/project/helpers.py index cb004d23ca..4d153492e2 100644 --- a/platformio/project/helpers.py +++ b/platformio/project/helpers.py @@ -131,27 +131,27 @@ def compute_project_checksum(config): return checksum.hexdigest() -def load_build_metadata(project_dir, env_or_envs, cache=False, debug=False): +def load_build_metadata(project_dir, env_or_envs, cache=False, build_type=None): assert env_or_envs env_names = env_or_envs if not isinstance(env_names, list): env_names = [env_names] with fs.cd(project_dir): - result = _get_cached_build_metadata(project_dir, env_names) if cache else {} + result = _get_cached_build_metadata(env_names) if cache else {} # incompatible build-type data - for name in list(result.keys()): - build_type = result[name].get("build_type", "") - outdated_conds = [ - not build_type, - debug and "debug" not in build_type, - not debug and "debug" in build_type, - ] - if any(outdated_conds): - del result[name] + for env_name in list(result.keys()): + if build_type is None: + build_type = ProjectConfig.get_instance().get( + f"env:{env_name}", "build_type" + ) + if result[env_name].get("build_type", "") != build_type: + del result[env_name] missed_env_names = set(env_names) - set(result.keys()) if missed_env_names: - result.update(_load_build_metadata(project_dir, missed_env_names, debug)) + result.update( + _load_build_metadata(project_dir, missed_env_names, build_type) + ) if not isinstance(env_or_envs, list) and env_or_envs in result: return result[env_or_envs] @@ -162,14 +162,16 @@ def load_build_metadata(project_dir, env_or_envs, cache=False, debug=False): load_project_ide_data = load_build_metadata -def _load_build_metadata(project_dir, env_names, debug=False): +def _load_build_metadata(project_dir, env_names, build_type=None): # pylint: disable=import-outside-toplevel from platformio import app from platformio.run.cli import cli as cmd_run args = ["--project-dir", project_dir, "--target", "__idedata"] - if debug: + if build_type == "debug": args.extend(["--target", "__debug"]) + # if build_type == "test": + # args.extend(["--target", "__test"]) for name in env_names: args.extend(["-e", name]) app.set_session_var("pause_telemetry", True) @@ -181,16 +183,16 @@ def _load_build_metadata(project_dir, env_names, debug=False): raise result.exception if '"includes":' not in result.output: raise exception.UserSideException(result.output) - return _get_cached_build_metadata(project_dir, env_names) + return _get_cached_build_metadata(env_names) -def _get_cached_build_metadata(project_dir, env_names): - build_dir = ProjectConfig.get_instance( - os.path.join(project_dir, "platformio.ini") - ).get("platformio", "build_dir") +def _get_cached_build_metadata(env_names): + build_dir = ProjectConfig.get_instance().get("platformio", "build_dir") result = {} - for name in env_names: - if not os.path.isfile(os.path.join(build_dir, name, "idedata.json")): + for env_name in env_names: + if not os.path.isfile(os.path.join(build_dir, env_name, "idedata.json")): continue - result[name] = fs.load_json(os.path.join(build_dir, name, "idedata.json")) + result[env_name] = fs.load_json( + os.path.join(build_dir, env_name, "idedata.json") + ) return result diff --git a/platformio/test/runners/unity.py b/platformio/test/runners/unity.py index 935a1328c9..0d0d9e82aa 100644 --- a/platformio/test/runners/unity.py +++ b/platformio/test/runners/unity.py @@ -184,10 +184,6 @@ class UnityTestRunner(TestRunnerBase): ), ) - def __init__(self, *args, **kwargs): - """Delete when Unity > 2.5.2 is released""" - super().__init__(*args, **kwargs) - def get_unity_framework_config(self): if not self.platform.is_embedded(): return self.UNITY_FRAMEWORK_CONFIG["native"] From 621b24b665710bf72471f8498c39d186c509626b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 17:08:03 +0200 Subject: [PATCH 21/39] Introduced the ``--json-output`` option to the `pio test` command // Resolve #4740 --- HISTORY.rst | 1 + docs | 2 +- platformio/test/cli.py | 4 ++++ platformio/test/reports/json.py | 6 ++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index a905f8588e..aac8e1c81c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. 6.1.14 (2024-??-??) ~~~~~~~~~~~~~~~~~~~ +* Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command diff --git a/docs b/docs index 37c10d2f72..5ada9ce233 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 37c10d2f72c18d1b3f84db661e96fa7732d2c7ad +Subproject commit 5ada9ce23361b0fd672932574fcea2ad9badf443 diff --git a/platformio/test/cli.py b/platformio/test/cli.py index 748580c8fb..9760545a48 100644 --- a/platformio/test/cli.py +++ b/platformio/test/cli.py @@ -14,6 +14,7 @@ import os import shutil +import subprocess import click @@ -79,6 +80,7 @@ help="A program argument (multiple are allowed)", ) @click.option("--list-tests", is_flag=True) +@click.option("--json-output", is_flag=True) @click.option("--json-output-path", type=click.Path()) @click.option("--junit-output-path", type=click.Path()) @click.option( @@ -105,6 +107,7 @@ def cli( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin monitor_dtr, program_args, list_tests, + json_output, json_output_path, junit_output_path, verbose, @@ -156,6 +159,7 @@ def cli( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin stdout_report.generate(verbose=verbose or list_tests) for output_format, output_path in [ + ("json", subprocess.STDOUT if json_output else None), ("json", json_output_path), ("junit", junit_output_path), ]: diff --git a/platformio/test/reports/json.py b/platformio/test/reports/json.py index 3d3c6f6e4e..8d834b384c 100644 --- a/platformio/test/reports/json.py +++ b/platformio/test/reports/json.py @@ -15,6 +15,7 @@ import datetime import json import os +import subprocess import click @@ -24,6 +25,9 @@ class JsonTestReport(TestReportBase): def generate(self, output_path, verbose=False): + if output_path == subprocess.STDOUT: + return click.echo("\n\n" + json.dumps(self.to_json())) + if os.path.isdir(output_path): output_path = os.path.join( output_path, @@ -40,6 +44,8 @@ def generate(self, output_path, verbose=False): if verbose: click.secho(f"Saved JSON report to the {output_path}", fg="green") + return True + def to_json(self): result = dict( version="1.0", From 93018930abefd4d90b3b8b1b82b33a73e1ce3211 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 17:08:28 +0200 Subject: [PATCH 22/39] Bump version to 6.1.14b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 450b2996cb..7c60f35b6e 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, "14a2") +VERSION = (6, 1, "14b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 76a11a75b780486206f074d374cbe89cbd4cca69 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 22:47:02 +0200 Subject: [PATCH 23/39] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 5ada9ce233..36e1a40131 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5ada9ce23361b0fd672932574fcea2ad9badf443 +Subproject commit 36e1a40131d5c34c3dd9dd38c9afc0ae6257c6d4 From d085a02068daff14a98640ce56bb6d1c50278ece Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 22 Feb 2024 18:27:22 +0200 Subject: [PATCH 24/39] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 36e1a40131..ad1f7f90c5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 36e1a40131d5c34c3dd9dd38c9afc0ae6257c6d4 +Subproject commit ad1f7f90c58347d8375ab88a77bbc588cf53b6c1 From 644911563581c83861b02d9ee94d814c4364a8f7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 12:30:38 +0200 Subject: [PATCH 25/39] Update dependencies --- platformio/pipdeps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/pipdeps.py b/platformio/pipdeps.py index e619341343..b76bc8caa3 100644 --- a/platformio/pipdeps.py +++ b/platformio/pipdeps.py @@ -36,7 +36,7 @@ def get_pip_dependencies(): # PIO Home requirements "ajsonrpc == 1.2.*", "starlette >=0.19, <0.38", - "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.28"), + "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.29"), "wsproto == 1.*", ] From 0f3dbe623d4fd1105b90aa405b213fe6638248f3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 12:30:51 +0200 Subject: [PATCH 26/39] Update tests --- tests/commands/test_lib_complex.py | 21 +++++++++++---------- tests/commands/test_platform.py | 10 +++++----- tests/package/test_manager.py | 22 +++++++++++----------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/tests/commands/test_lib_complex.py b/tests/commands/test_lib_complex.py index eb56c5b74d..a4e8faff62 100644 --- a/tests/commands/test_lib_complex.py +++ b/tests/commands/test_lib_complex.py @@ -23,6 +23,7 @@ from platformio.util import strip_ansi_codes PlatformioCLI.leftover_args = ["--json-output"] # hook for click +ARDUINO_JSON_VERSION = "6.21.5" def test_search(clirunner, validate_cliresult): @@ -44,10 +45,10 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_cor "-g", "install", "64", - "ArduinoJson@~5.10.0", - "547@2.2.4", + "ArduinoJson@~6", + "547@2.7.3", "AsyncMqttClient@<=0.8.2", - "Adafruit PN532@1.2.0", + "Adafruit PN532@1.3.2", ], ) validate_cliresult(result) @@ -60,7 +61,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_cor items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = [ "ArduinoJson", - "ArduinoJson@5.10.1", + "fArduinoJson@{ARDUINO_JSON_VERSION}", "NeoPixelBus", "AsyncMqttClient", "ESPAsyncTCP", @@ -79,7 +80,7 @@ def test_global_install_archive(clirunner, validate_cliresult, isolated_pio_core "install", "https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip", "https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip@5.8.2", - "SomeLib=https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.8.1/DallasTemperature-3.8.1.tar.gz", + "SomeLib=https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.11.0/DallasTemperature-3.11.0.tar.gz", "https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip", ], ) @@ -142,7 +143,7 @@ def test_install_duplicates( # pylint: disable=unused-argument [ "-g", "install", - "https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.8.1/DallasTemperature-3.8.1.tar.gz", + "https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.11.0/DallasTemperature-3.11.0.tar.gz", ], ) validate_cliresult(result) @@ -176,11 +177,11 @@ def test_global_lib_list(clirunner, validate_cliresult): n in result.output for n in ( "required: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip", - "ArduinoJson @ 5.10.1", + f"ArduinoJson @ {ARDUINO_JSON_VERSION}", "required: git+https://github.com/gioblu/PJON.git#3.0", "PJON @ 3.0.0+sha.1fb26f", ) - ) + ), result.output result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"]) assert all( @@ -220,7 +221,7 @@ def test_global_lib_list(clirunner, validate_cliresult): "ArduinoJson@5.8.2", "ArduinoJson@5.10.1", "AsyncMqttClient@0.8.2", - "NeoPixelBus@2.2.4", + "NeoPixelBus@2.7.3", "PJON@6.2.0+sha.07fe9aa", "PJON@3.0.0+sha.1fb26fd", "PubSubClient@2.6.0+sha.bef5814", @@ -249,7 +250,7 @@ def test_global_lib_update(clirunner, validate_cliresult): assert "__pkg_dir" in oudated[0] result = clirunner.invoke(cmd_lib, ["-g", "update", oudated[0]["__pkg_dir"]]) validate_cliresult(result) - assert "Removing NeoPixelBus @ 2.2.4" in strip_ansi_codes(result.output) + assert "Removing NeoPixelBus @ 2.7.3" in strip_ansi_codes(result.output) # update all libraries result = clirunner.invoke( diff --git a/tests/commands/test_platform.py b/tests/commands/test_platform.py index 967bf51e78..b832a366f4 100644 --- a/tests/commands/test_platform.py +++ b/tests/commands/test_platform.py @@ -63,7 +63,7 @@ def test_install_unknown_from_registry(clirunner): def test_install_core_3_dev_platform(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_install, - ["atmelavr@1.2.0", "--skip-default-package"], + ["atmelavr@2.2.0", "--skip-default-package"], ) assert result.exit_code == 0 @@ -71,11 +71,11 @@ def test_install_core_3_dev_platform(clirunner, validate_cliresult, isolated_pio def test_install_known_version(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_install, - ["atmelavr@2.0.0", "--skip-default-package", "--with-package", "tool-avrdude"], + ["atmelavr@4.2.0", "--skip-default-package", "--with-package", "tool-avrdude"], ) validate_cliresult(result) output = strip_ansi_codes(result.output) - assert "atmelavr @ 2.0.0" in output + assert "atmelavr@4.2.0" in output assert not os.path.isdir(str(isolated_pio_core.join("packages"))) @@ -128,14 +128,14 @@ def test_update_raw(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cli_platform.platform_update, ["atmelavr"]) validate_cliresult(result) output = strip_ansi_codes(result.output) - assert "Removing atmelavr @ 2.0.0" in output + assert "Removing atmelavr @ 4.2.0" in output assert "Platform Manager: Installing platformio/atmelavr @" in output assert len(isolated_pio_core.join("packages").listdir()) == 2 def test_uninstall(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( - cli_platform.platform_uninstall, ["atmelavr@1.2.0", "atmelavr", "espressif8266"] + cli_platform.platform_uninstall, ["atmelavr@2.2.0", "atmelavr", "espressif8266"] ) validate_cliresult(result) assert not isolated_pio_core.join("platforms").listdir() diff --git a/tests/package/test_manager.py b/tests/package/test_manager.py index fa3f215c25..fc210467ed 100644 --- a/tests/package/test_manager.py +++ b/tests/package/test_manager.py @@ -219,7 +219,7 @@ def test_install_from_registry(isolated_pio_core, tmpdir_factory): # test conflicted names lm = LibraryPackageManager(str(tmpdir_factory.mktemp("conflicted-storage"))) lm.set_log_level(logging.ERROR) - lm.install("z3t0/IRremote@2.6.1") + lm.install("z3t0/IRremote") lm.install("mbed-yuhki50/IRremote") assert len(lm.get_installed()) == 2 @@ -554,14 +554,14 @@ def test_uninstall(isolated_pio_core, tmpdir_factory): assert not lm.get_installed() # test uninstall dependencies - assert lm.install("AsyncMqttClient-esphome @ 0.8.4") + assert lm.install("AsyncMqttClient-esphome") assert len(lm.get_installed()) == 3 assert lm.uninstall("AsyncMqttClient-esphome", skip_dependencies=True) assert len(lm.get_installed()) == 2 lm = LibraryPackageManager(str(storage_dir)) lm.set_log_level(logging.ERROR) - assert lm.install("AsyncMqttClient-esphome @ 0.8.4") + assert lm.install("AsyncMqttClient-esphome") assert lm.uninstall("AsyncMqttClient-esphome") assert not lm.get_installed() @@ -604,23 +604,23 @@ def test_update_with_metadata(isolated_pio_core, tmpdir_factory): assert str(outdated.current) == "1.8.7" assert outdated.latest > semantic_version.Version("1.10.0") - pkg = lm.install("ArduinoJson @ 5.10.1") + pkg = lm.install("ArduinoJson @ 6.19.4") # test latest outdated = lm.outdated(pkg) - assert str(outdated.current) == "5.10.1" + assert str(outdated.current) == "6.19.4" assert outdated.wanted is None assert outdated.latest > outdated.current assert outdated.latest > semantic_version.Version("5.99.99") # test wanted - outdated = lm.outdated(pkg, PackageSpec("ArduinoJson@~5")) - assert str(outdated.current) == "5.10.1" - assert str(outdated.wanted) == "5.13.4" + outdated = lm.outdated(pkg, PackageSpec("ArduinoJson@~6")) + assert str(outdated.current) == "6.19.4" + assert str(outdated.wanted) == "6.21.5" assert outdated.latest > semantic_version.Version("6.16.0") - # update to the wanted 5.x - new_pkg = lm.update("ArduinoJson@^5", PackageSpec("ArduinoJson@^5")) - assert str(new_pkg.metadata.version) == "5.13.4" + # update to the wanted 6.x + new_pkg = lm.update("ArduinoJson@^6", PackageSpec("ArduinoJson@^6")) + assert str(new_pkg.metadata.version) == "6.21.5" # check that old version is removed assert len(lm.get_installed()) == 2 From c0d97287ddc94bb26ffd45cdb809c3e82b72118b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 12:32:15 +0200 Subject: [PATCH 27/39] Add support for Python 3.12+ Tar extract filter --- platformio/package/unpack.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/platformio/package/unpack.py b/platformio/package/unpack.py index 9d8919c32f..f819fd2f96 100644 --- a/platformio/package/unpack.py +++ b/platformio/package/unpack.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import sys from tarfile import open as tarfile_open from time import mktime from zipfile import ZipFile @@ -82,19 +83,23 @@ def is_bad_link(self, item, base): ).startswith(base) def extract_item(self, item, dest_dir): + if sys.version_info >= (3, 12): + self._afo.extract(item, dest_dir, filter="data") + return self.after_extract(item, dest_dir) + + # apply custom security logic dest_dir = self.resolve_path(dest_dir) bad_conds = [ self.is_bad_path(item.name, dest_dir), self.is_link(item) and self.is_bad_link(item, dest_dir), ] - if not any(bad_conds): - super().extract_item(item, dest_dir) - else: - click.secho( + if any(bad_conds): + return click.secho( "Blocked insecure item `%s` from TAR archive" % item.name, fg="red", err=True, ) + return super().extract_item(item, dest_dir) class ZIPArchiver(BaseArchiver): From 430acc87de097495d003e42826f2477a6c2f3990 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Sat, 16 Mar 2024 07:29:31 -0400 Subject: [PATCH 28/39] Fix symlink package spec validation (#4870) When validating symlink:// packages, use the specified symlink path, the same as for file:// packages. This fixes missing symlink packages in 'pkg list' and reinstalling on every build. --- platformio/package/manager/base.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/platformio/package/manager/base.py b/platformio/package/manager/base.py index f197ea120d..cfb49ebc32 100644 --- a/platformio/package/manager/base.py +++ b/platformio/package/manager/base.py @@ -281,9 +281,16 @@ def test_pkg_spec(pkg, spec): # external "URL" mismatch if spec.external: # local folder mismatch - if os.path.abspath(spec.uri) == os.path.abspath(pkg.path) or ( - spec.uri.startswith("file://") - and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]) + if ( + os.path.abspath(spec.uri) == os.path.abspath(pkg.path) + or ( + spec.uri.startswith("file://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]) + ) + or ( + spec.uri.startswith("symlink://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[10:]) + ) ): return True if spec.uri != pkg.metadata.spec.uri: From c28740cfb16943977c2051df19dc3e28864571a5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 13:43:44 +0200 Subject: [PATCH 29/39] Update tests --- tests/commands/pkg/test_outdated.py | 6 +++--- tests/commands/pkg/test_update.py | 12 +++++++----- tests/commands/test_lib.py | 30 ++++++++++++++--------------- tests/commands/test_lib_complex.py | 8 ++++---- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/tests/commands/pkg/test_outdated.py b/tests/commands/pkg/test_outdated.py index 91180b4204..c13d4d2a5a 100644 --- a/tests/commands/pkg/test_outdated.py +++ b/tests/commands/pkg/test_outdated.py @@ -24,7 +24,7 @@ platform = platformio/atmelavr@^2 framework = arduino board = attiny88 -lib_deps = milesburton/DallasTemperature@~3.8.0 +lib_deps = milesburton/DallasTemperature@~3.9.0 """ PROJECT_UPDATED_CONFIG_TPL = """ @@ -32,7 +32,7 @@ platform = platformio/atmelavr@<4 framework = arduino board = attiny88 -lib_deps = milesburton/DallasTemperature@^3.8.0 +lib_deps = milesburton/DallasTemperature@^3.9.0 """ @@ -56,7 +56,7 @@ def test_project(clirunner, validate_cliresult, isolated_pio_core, tmp_path): re.MULTILINE, ) assert re.search( - r"^DallasTemperature\s+3\.8\.1\s+3\.\d+\.\d+\s+3\.\d+\.\d+\s+Library\s+devkit", + r"^DallasTemperature\s+3\.\.1\s+3\.\d+\.\d+\s+3\.\d+\.\d+\s+Library\s+devkit", result.output, re.MULTILINE, ) diff --git a/tests/commands/pkg/test_update.py b/tests/commands/pkg/test_update.py index 5656daac04..1fd953edbc 100644 --- a/tests/commands/pkg/test_update.py +++ b/tests/commands/pkg/test_update.py @@ -26,12 +26,14 @@ from platformio.package.meta import PackageSpec from platformio.project.config import ProjectConfig +DALLASTEMPERATURE_LATEST_VERSION = "3.11.0" + PROJECT_OUTDATED_CONFIG_TPL = """ [env:devkit] platform = platformio/atmelavr@^2 framework = arduino board = attiny88 -lib_deps = milesburton/DallasTemperature@~3.8.0 +lib_deps = milesburton/DallasTemperature@^3.8.0 """ PROJECT_UPDATED_CONFIG_TPL = """ @@ -162,7 +164,7 @@ def test_project( os.path.join(config.get("platformio", "libdeps_dir"), "devkit") ) assert pkgs_to_specs(lm.get_installed()) == [ - PackageSpec("DallasTemperature@3.8.1"), + PackageSpec(f"DallasTemperature@{DALLASTEMPERATURE_LATEST_VERSION}"), PackageSpec( "OneWire@%s" % get_pkg_latest_version("paulstoffregen/OneWire") ), @@ -176,7 +178,7 @@ def test_project( PackageSpec("toolchain-atmelavr@1.50400.190710"), ] assert config.get("env:devkit", "lib_deps") == [ - "milesburton/DallasTemperature@~3.8.0" + "milesburton/DallasTemperature@^3.8.0" ] # update packages @@ -227,7 +229,7 @@ def test_custom_project_libraries( project_dir = tmp_path / "project" project_dir.mkdir() (project_dir / "platformio.ini").write_text(PROJECT_OUTDATED_CONFIG_TPL) - spec = "milesburton/DallasTemperature@~3.8.0" + spec = "milesburton/DallasTemperature@^3.8.0" result = clirunner.invoke( package_install_cmd, ["-d", str(project_dir), "-e", "devkit", "-l", spec], @@ -240,7 +242,7 @@ def test_custom_project_libraries( os.path.join(config.get("platformio", "libdeps_dir"), "devkit") ) assert pkgs_to_specs(lm.get_installed()) == [ - PackageSpec("DallasTemperature@3.8.1"), + PackageSpec(f"DallasTemperature@{DALLASTEMPERATURE_LATEST_VERSION}"), PackageSpec( "OneWire@%s" % get_pkg_latest_version("paulstoffregen/OneWire") ), diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index 8f47ad619e..221d788f94 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -42,7 +42,7 @@ def test_saving_deps(clirunner, validate_cliresult, isolated_pio_core, tmpdir_fa framework = foo lib_deps = CustomLib - ArduinoJson @ 5.10.1 + ArduinoJson @ 6.18.5 """ ) result = clirunner.invoke( @@ -163,7 +163,7 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core, tmpdir_factory storage_dir = tmpdir_factory.mktemp("test-updates") result = clirunner.invoke( cmd_lib, - ["-d", str(storage_dir), "install", "ArduinoJson @ 5.10.1", "Blynk @ ~0.5.0"], + ["-d", str(storage_dir), "install", "ArduinoJson @ 6.18.5", "Blynk @ ~1.2"], ) validate_cliresult(result) result = clirunner.invoke( @@ -173,17 +173,17 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core, tmpdir_factory outdated = json.loads(result.stdout) assert len(outdated) == 2 # ArduinoJson - assert outdated[0]["version"] == "5.10.1" + assert outdated[0]["version"] == "6.18.5" assert outdated[0]["versionWanted"] is None assert semantic_version.Version( outdated[0]["versionLatest"] - ) > semantic_version.Version("6.16.0") + ) > semantic_version.Version("6.18.5") # Blynk - assert outdated[1]["version"] == "0.5.4" + assert outdated[1]["version"] == "1.2.0" assert outdated[1]["versionWanted"] is None assert semantic_version.Version( outdated[1]["versionLatest"] - ) > semantic_version.Version("0.6.0") + ) > semantic_version.Version("1.2.0") # check with spec result = clirunner.invoke( @@ -194,19 +194,19 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core, tmpdir_factory "update", "--dry-run", "--json-output", - "ArduinoJson @ ^5", + "ArduinoJson @ ^6", ], ) validate_cliresult(result) outdated = json.loads(result.stdout) - assert outdated[0]["version"] == "5.10.1" - assert outdated[0]["versionWanted"] == "5.13.4" + assert outdated[0]["version"] == "6.18.5" + assert outdated[0]["versionWanted"] == "6.21.5" assert semantic_version.Version( outdated[0]["versionLatest"] ) > semantic_version.Version("6.16.0") # update with spec result = clirunner.invoke( - cmd_lib, ["-d", str(storage_dir), "update", "--silent", "ArduinoJson @ ^5.10.1"] + cmd_lib, ["-d", str(storage_dir), "update", "--silent", "ArduinoJson @ ^6.18.5"] ) validate_cliresult(result) result = clirunner.invoke( @@ -215,12 +215,12 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core, tmpdir_factory validate_cliresult(result) items = json.loads(result.stdout) assert len(items) == 2 - assert items[0]["version"] == "5.13.4" - assert items[1]["version"] == "0.5.4" + assert items[0]["version"] == "6.21.5" + assert items[1]["version"] == "1.2.0" # Check incompatible result = clirunner.invoke( - cmd_lib, ["-d", str(storage_dir), "update", "--dry-run", "ArduinoJson @ ^5"] + cmd_lib, ["-d", str(storage_dir), "update", "--dry-run", "ArduinoJson @ ^6"] ) with pytest.raises( AssertionError, @@ -228,7 +228,7 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core, tmpdir_factory ): validate_cliresult(result) result = clirunner.invoke( - cmd_lib, ["-d", str(storage_dir), "update", "ArduinoJson @ ^5"] + cmd_lib, ["-d", str(storage_dir), "update", "ArduinoJson @ ^6"] ) validate_cliresult(result) - assert "ArduinoJson@5.13.4 is already up-to-date" in result.stdout + assert "ArduinoJson@6.21.5 is already up-to-date" in result.stdout diff --git a/tests/commands/test_lib_complex.py b/tests/commands/test_lib_complex.py index a4e8faff62..55563be508 100644 --- a/tests/commands/test_lib_complex.py +++ b/tests/commands/test_lib_complex.py @@ -61,7 +61,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_cor items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = [ "ArduinoJson", - "fArduinoJson@{ARDUINO_JSON_VERSION}", + f"ArduinoJson@{ARDUINO_JSON_VERSION}", "NeoPixelBus", "AsyncMqttClient", "ESPAsyncTCP", @@ -189,7 +189,7 @@ def test_global_lib_list(clirunner, validate_cliresult): for n in ( "__pkg_dir", '"__src_url": "git+https://github.com/gioblu/PJON.git#6.2"', - '"version": "5.10.1"', + f'"version": "{ARDUINO_JSON_VERSION}"', ) ) items1 = [i["name"] for i in json.loads(result.output)] @@ -219,13 +219,13 @@ def test_global_lib_list(clirunner, validate_cliresult): ] versions2 = [ "ArduinoJson@5.8.2", - "ArduinoJson@5.10.1", + f"ArduinoJson@{ARDUINO_JSON_VERSION}", "AsyncMqttClient@0.8.2", "NeoPixelBus@2.7.3", "PJON@6.2.0+sha.07fe9aa", "PJON@3.0.0+sha.1fb26fd", "PubSubClient@2.6.0+sha.bef5814", - "Adafruit PN532@1.2.0", + "Adafruit PN532@1.3.2", ] assert set(versions1) >= set(versions2) From d36e39418e95692db127e3c8d20887ae89a52fc4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 13:45:21 +0200 Subject: [PATCH 30/39] Corrected the validation of ``symlink://`` package specifications // Issue #4870 --- HISTORY.rst | 1 + platformio/package/manager/base.py | 21 +++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index aac8e1c81c..d4ac1284d1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -23,6 +23,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. * Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) +* Corrected the validation of ``symlink://`` `package specifications `__ , resolving an issue that caused the package manager to repeatedly reinstall dependencies (`pull #4870 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command * Resolved an issue where the |LDF| selected an incorrect library version (`issue #4860 `_) * Resolved an issue with the ``hexlify`` filter in the `device monitor `__ command, ensuring proper representation of characters with Unicode code points higher than 127 (`issue #4732 `_) diff --git a/platformio/package/manager/base.py b/platformio/package/manager/base.py index cfb49ebc32..a4ad07bafb 100644 --- a/platformio/package/manager/base.py +++ b/platformio/package/manager/base.py @@ -280,18 +280,15 @@ def test_pkg_spec(pkg, spec): # external "URL" mismatch if spec.external: - # local folder mismatch - if ( - os.path.abspath(spec.uri) == os.path.abspath(pkg.path) - or ( - spec.uri.startswith("file://") - and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]) - ) - or ( - spec.uri.startswith("symlink://") - and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[10:]) - ) - ): + # local/symlinked folder mismatch + check_conds = [ + os.path.abspath(spec.uri) == os.path.abspath(pkg.path), + spec.uri.startswith("file://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]), + spec.uri.startswith("symlink://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[10:]), + ] + if any(check_conds): return True if spec.uri != pkg.metadata.spec.uri: return False From dbe58b49bf4a254e53da6b5924768ee516914e5e Mon Sep 17 00:00:00 2001 From: adrianstephens Date: Sat, 16 Mar 2024 05:00:30 -0700 Subject: [PATCH 31/39] paths fix for check tool (#4874) * paths fix for check tool * Minor changes - Handle an edge case on Windows when sources and the project are located on different drives - Cover edge cases with tests --------- Co-authored-by: Valerii Koval --- platformio/check/cli.py | 19 +++++++++++---- tests/commands/test_check.py | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/platformio/check/cli.py b/platformio/check/cli.py index 3e0c175996..9adf7fb9be 100644 --- a/platformio/check/cli.py +++ b/platformio/check/cli.py @@ -103,10 +103,21 @@ def cli( "%s: %s" % (k, ", ".join(v) if isinstance(v, list) else v) ) - default_src_filters = [ - "+<%s>" % os.path.basename(config.get("platformio", "src_dir")), - "+<%s>" % os.path.basename(config.get("platformio", "include_dir")), - ] + default_src_filters = [] + for d in ( + config.get("platformio", "src_dir"), + config.get("platformio", "include_dir"), + ): + try: + default_src_filters.append("+<%s>" % os.path.relpath(d)) + except ValueError as exc: + # On Windows if sources are located on a different logical drive + if not json_output and not silent: + click.echo( + "Error: Project cannot be analyzed! The project folder `%s`" + " is located on a different logical drive\n" % d + ) + raise exception.ReturnErrorCode(1) from exc env_src_filters = ( src_filters diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index a9a99d6509..5f32e77d71 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -803,3 +803,49 @@ def test_check_src_filter_multiple_envs(clirunner, validate_cliresult, tmpdir_fa assert errors + warnings + style == EXPECTED_DEFECTS assert "test.cpp" in result.output assert "main.cpp" not in result.output + + +def test_check_sources_in_project_root(clirunner, validate_cliresult, tmpdir_factory): + tmpdir = tmpdir_factory.mktemp("project") + + config = ( + """ +[platformio] +src_dir = ./ + """ + + DEFAULT_CONFIG + ) + tmpdir.join("platformio.ini").write(config) + tmpdir.join("main.cpp").write(TEST_CODE) + tmpdir.mkdir("spi").join("uart.cpp").write(TEST_CODE) + + result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) + validate_cliresult(result) + + errors, warnings, style = count_defects(result.output) + + assert result.exit_code == 0 + assert errors + warnings + style == EXPECTED_DEFECTS * 2 + + +def test_check_sources_in_external_dir(clirunner, validate_cliresult, tmpdir_factory): + tmpdir = tmpdir_factory.mktemp("project") + external_src_dir = tmpdir_factory.mktemp("external_src_dir") + + config = ( + f""" +[platformio] +src_dir = {external_src_dir} + """ + + DEFAULT_CONFIG + ) + tmpdir.join("platformio.ini").write(config) + external_src_dir.join("main.cpp").write(TEST_CODE) + + result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)]) + validate_cliresult(result) + + errors, warnings, style = count_defects(result.output) + + assert result.exit_code == 0 + assert errors + warnings + style == EXPECTED_DEFECTS From 32991356f324564c3afc1fea8ffd9f06c3475780 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 14:07:01 +0200 Subject: [PATCH 32/39] Enhanced Static Code Analysis to accommodate scenarios where custom `src_dir` or `include_dir` are located outside the project folder // Issue #4874 --- HISTORY.rst | 2 ++ tests/commands/pkg/test_outdated.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index d4ac1284d1..e5b446040c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ Release Notes .. |INTERPOLATION| replace:: `Interpolation of Values `__ .. |UNITTESTING| replace:: `Unit Testing `__ .. |DEBUGGING| replace:: `Debugging `__ +.. |STATICCODEANALYSIS| replace:: `Static Code Analysis `__ .. _release_notes_6: @@ -23,6 +24,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. * Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) +* Enhanced |STATICCODEANALYSIS| to accommodate scenarios where custom ``src_dir`` or ``include_dir`` are located outside the project folder (`pull #4874 `_) * Corrected the validation of ``symlink://`` `package specifications `__ , resolving an issue that caused the package manager to repeatedly reinstall dependencies (`pull #4870 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command * Resolved an issue where the |LDF| selected an incorrect library version (`issue #4860 `_) diff --git a/tests/commands/pkg/test_outdated.py b/tests/commands/pkg/test_outdated.py index c13d4d2a5a..58f3b0f75b 100644 --- a/tests/commands/pkg/test_outdated.py +++ b/tests/commands/pkg/test_outdated.py @@ -56,7 +56,7 @@ def test_project(clirunner, validate_cliresult, isolated_pio_core, tmp_path): re.MULTILINE, ) assert re.search( - r"^DallasTemperature\s+3\.\.1\s+3\.\d+\.\d+\s+3\.\d+\.\d+\s+Library\s+devkit", + r"^DallasTemperature\s+3\.\d\.1\s+3\.\d+\.\d+\s+3\.\d+\.\d+\s+Library\s+devkit", result.output, re.MULTILINE, ) From 56be27fb0bb3bf441070d62acd5ddfd31c929b28 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 15:15:05 +0200 Subject: [PATCH 33/39] Bump version to 6.1.14rc1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 7c60f35b6e..35aa5939cf 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, "14b1") +VERSION = (6, 1, "14rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 28bd200cd6641a9d2f3eb0097047f42233bd7b1b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 18 Mar 2024 13:14:22 +0200 Subject: [PATCH 34/39] Move core/pip dependencies to the separate "dependencies" module --- platformio/__init__.py | 9 -------- platformio/commands/upgrade.py | 2 +- platformio/compat.py | 11 ++++++++++ platformio/{pipdeps.py => dependencies.py} | 24 +++++++++++----------- platformio/http.py | 2 +- platformio/package/manager/core.py | 13 ++++++------ setup.py | 2 +- tests/commands/pkg/test_install.py | 7 ++++--- tests/commands/pkg/test_update.py | 7 ++++--- 9 files changed, 41 insertions(+), 36 deletions(-) rename platformio/{pipdeps.py => dependencies.py} (84%) diff --git a/platformio/__init__.py b/platformio/__init__.py index 35aa5939cf..49b5bf7723 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -38,15 +38,6 @@ ] __pioremote_endpoint__ = "ssl:host=remote.platformio.org:port=4413" -__core_packages__ = { - "contrib-piohome": "~3.4.2", - "contrib-pioremote": "~1.0.0", - "tool-scons": "~4.40600.0", - "tool-cppcheck": "~1.21100.0", - "tool-clangtidy": "~1.150005.0", - "tool-pvs-studio": "~7.18.0", -} - __check_internet_hosts__ = [ "185.199.110.153", # Github.com "88.198.170.159", # platformio.org diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 129e3fa189..d8ba386e6b 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -19,9 +19,9 @@ import click from platformio import VERSION, __version__, app, exception +from platformio.dependencies import get_pip_dependencies from platformio.http import fetch_remote_content from platformio.package.manager.core import update_core_packages -from platformio.pipdeps import get_pip_dependencies from platformio.proc import get_pythonexe_path PYPI_JSON_URL = "https://pypi.org/pypi/platformio/json" diff --git a/platformio/compat.py b/platformio/compat.py index 008dc7ae01..6bd8029cd4 100644 --- a/platformio/compat.py +++ b/platformio/compat.py @@ -17,6 +17,7 @@ import importlib.util import inspect import locale +import os import shlex import sys @@ -45,6 +46,7 @@ def shlex_join(split_command): PY2 = sys.version_info[0] == 2 # DO NOT REMOVE IT. ESP8266/ESP32 depend on it +PY36 = sys.version_info[0:2] == (3, 6) IS_CYGWIN = sys.platform.startswith("cygwin") IS_WINDOWS = WINDOWS = sys.platform.startswith("win") IS_MACOS = sys.platform.startswith("darwin") @@ -132,3 +134,12 @@ def path_to_unicode(path): and custom device monitor filters """ return path + + +def is_proxy_set(socks=False): + for var in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"): + value = os.getenv(var, os.getenv(var.lower())) + if not value or (socks and not value.startswith("socks5://")): + continue + return True + return False diff --git a/platformio/pipdeps.py b/platformio/dependencies.py similarity index 84% rename from platformio/pipdeps.py rename to platformio/dependencies.py index b76bc8caa3..b8ae471f71 100644 --- a/platformio/pipdeps.py +++ b/platformio/dependencies.py @@ -12,11 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import platform -import sys -PY36 = sys.version_info[0:2] == (3, 6) +from platformio.compat import PY36, is_proxy_set + + +def get_core_dependencies(): + return { + "contrib-piohome": "~3.4.2", + "contrib-pioremote": "~1.0.0", + "tool-scons": "~4.40600.0", + "tool-cppcheck": "~1.21100.0", + "tool-clangtidy": "~1.150005.0", + "tool-pvs-studio": "~7.18.0", + } def get_pip_dependencies(): @@ -60,12 +69,3 @@ def get_pip_dependencies(): pass return core + home + extra - - -def is_proxy_set(socks=False): - for var in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"): - value = os.getenv(var, os.getenv(var.lower())) - if not value or (socks and not value.startswith("socks5://")): - continue - return True - return False diff --git a/platformio/http.py b/platformio/http.py index 18bb50c625..d82e4703c6 100644 --- a/platformio/http.py +++ b/platformio/http.py @@ -21,8 +21,8 @@ from platformio import __check_internet_hosts__, app, util from platformio.cache import ContentCache, cleanup_content_cache +from platformio.compat import is_proxy_set from platformio.exception import PlatformioException, UserSideException -from platformio.pipdeps import is_proxy_set __default_requests_timeout__ = (10, None) # (connect, read) diff --git a/platformio/package/manager/core.py b/platformio/package/manager/core.py index ca5c5e0136..f4e0f50ea4 100644 --- a/platformio/package/manager/core.py +++ b/platformio/package/manager/core.py @@ -14,7 +14,8 @@ import os -from platformio import __core_packages__, exception +from platformio import exception +from platformio.dependencies import get_core_dependencies from platformio.package.exception import UnknownPackageError from platformio.package.manager.tool import ToolPackageManager from platformio.package.meta import PackageSpec @@ -23,7 +24,7 @@ def get_installed_core_packages(): result = [] pm = ToolPackageManager() - for name, requirements in __core_packages__.items(): + for name, requirements in get_core_dependencies().items(): spec = PackageSpec(owner="platformio", name=name, requirements=requirements) pkg = pm.get_package(spec) if pkg: @@ -32,11 +33,11 @@ def get_installed_core_packages(): def get_core_package_dir(name, spec=None, auto_install=True): - if name not in __core_packages__: + if name not in get_core_dependencies(): raise exception.PlatformioException("Please upgrade PlatformIO Core") pm = ToolPackageManager() spec = spec or PackageSpec( - owner="platformio", name=name, requirements=__core_packages__[name] + owner="platformio", name=name, requirements=get_core_dependencies()[name] ) pkg = pm.get_package(spec) if pkg: @@ -50,7 +51,7 @@ def get_core_package_dir(name, spec=None, auto_install=True): def update_core_packages(): pm = ToolPackageManager() - for name, requirements in __core_packages__.items(): + for name, requirements in get_core_dependencies().items(): spec = PackageSpec(owner="platformio", name=name, requirements=requirements) try: pm.update(spec, spec) @@ -65,7 +66,7 @@ def remove_unnecessary_core_packages(dry_run=False): pm = ToolPackageManager() best_pkg_versions = {} - for name, requirements in __core_packages__.items(): + for name, requirements in get_core_dependencies().items(): spec = PackageSpec(owner="platformio", name=name, requirements=requirements) pkg = pm.get_package(spec) if not pkg: diff --git a/setup.py b/setup.py index 7a7c507631..e4eae2386d 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ __url__, __version__, ) -from platformio.pipdeps import get_pip_dependencies +from platformio.dependencies import get_pip_dependencies setup( name=__title__, diff --git a/tests/commands/pkg/test_install.py b/tests/commands/pkg/test_install.py index 22963ef911..2c62331409 100644 --- a/tests/commands/pkg/test_install.py +++ b/tests/commands/pkg/test_install.py @@ -18,7 +18,8 @@ import pytest -from platformio import __core_packages__, fs +from platformio import fs +from platformio.dependencies import get_core_dependencies from platformio.package.commands.install import package_install_cmd from platformio.package.manager.library import LibraryPackageManager from platformio.package.manager.platform import PlatformPackageManager @@ -177,7 +178,7 @@ def test_baremetal_project( ), ] assert pkgs_to_specs(ToolPackageManager().get_installed()) == [ - PackageSpec("tool-scons@%s" % __core_packages__["tool-scons"][1:]), + PackageSpec("tool-scons@%s" % get_core_dependencies()["tool-scons"][1:]), PackageSpec("toolchain-atmelavr@1.70300.191015"), ] @@ -210,7 +211,7 @@ def test_project( ] assert pkgs_to_specs(ToolPackageManager().get_installed()) == [ PackageSpec("framework-arduino-avr-attiny@1.5.2"), - PackageSpec("tool-scons@%s" % __core_packages__["tool-scons"][1:]), + PackageSpec("tool-scons@%s" % get_core_dependencies()["tool-scons"][1:]), PackageSpec("toolchain-atmelavr@1.70300.191015"), ] assert config.get("env:devkit", "lib_deps") == [ diff --git a/tests/commands/pkg/test_update.py b/tests/commands/pkg/test_update.py index 1fd953edbc..4ee4366a78 100644 --- a/tests/commands/pkg/test_update.py +++ b/tests/commands/pkg/test_update.py @@ -16,7 +16,8 @@ import os -from platformio import __core_packages__, fs +from platformio import fs +from platformio.dependencies import get_core_dependencies from platformio.package.commands.install import package_install_cmd from platformio.package.commands.update import package_update_cmd from platformio.package.exception import UnknownPackageError @@ -174,7 +175,7 @@ def test_project( ] assert pkgs_to_specs(ToolPackageManager().get_installed()) == [ PackageSpec("framework-arduino-avr-attiny@1.3.2"), - PackageSpec("tool-scons@%s" % __core_packages__["tool-scons"][1:]), + PackageSpec("tool-scons@%s" % get_core_dependencies()["tool-scons"][1:]), PackageSpec("toolchain-atmelavr@1.50400.190710"), ] assert config.get("env:devkit", "lib_deps") == [ @@ -204,7 +205,7 @@ def test_project( ] assert pkgs_to_specs(ToolPackageManager().get_installed()) == [ PackageSpec("framework-arduino-avr-attiny@1.3.2"), - PackageSpec("tool-scons@%s" % __core_packages__["tool-scons"][1:]), + PackageSpec("tool-scons@%s" % get_core_dependencies()["tool-scons"][1:]), PackageSpec("toolchain-atmelavr@1.70300.191015"), PackageSpec("toolchain-atmelavr@1.50400.190710"), ] From 9fb9e586a0adc0e61fa8055ed8604b4866590a2f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 18 Mar 2024 13:14:39 +0200 Subject: [PATCH 35/39] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ad1f7f90c5..8528634148 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ad1f7f90c58347d8375ab88a77bbc588cf53b6c1 +Subproject commit 8528634148a1edfdc96966ef6a1eb8456cfd8694 From c01ef88265fce547c691d6a08b369a681fd14ece Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 18 Mar 2024 14:27:45 +0200 Subject: [PATCH 36/39] Upgraded the build engine to the latest version of SCons (4.7.0) --- HISTORY.rst | 1 + platformio/dependencies.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index e5b446040c..1e4bd6978a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. ~~~~~~~~~~~~~~~~~~~ * Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format +* Upgraded the build engine to the latest version of SCons (4.7.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes `__) * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) * Enhanced |STATICCODEANALYSIS| to accommodate scenarios where custom ``src_dir`` or ``include_dir`` are located outside the project folder (`pull #4874 `_) diff --git a/platformio/dependencies.py b/platformio/dependencies.py index b8ae471f71..6bcb5f906a 100644 --- a/platformio/dependencies.py +++ b/platformio/dependencies.py @@ -21,7 +21,7 @@ def get_core_dependencies(): return { "contrib-piohome": "~3.4.2", "contrib-pioremote": "~1.0.0", - "tool-scons": "~4.40600.0", + "tool-scons": "~4.40700.0", "tool-cppcheck": "~1.21100.0", "tool-clangtidy": "~1.150005.0", "tool-pvs-studio": "~7.18.0", From 0d647e164b1e0ecc467a64fdde7a0a563344ac39 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 18 Mar 2024 17:45:54 +0200 Subject: [PATCH 37/39] Skip unnecessary import --- platformio/compat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platformio/compat.py b/platformio/compat.py index 6bd8029cd4..d545509991 100644 --- a/platformio/compat.py +++ b/platformio/compat.py @@ -42,7 +42,10 @@ def shlex_join(split_command): if sys.version_info >= (3, 9): from asyncio import to_thread as aio_to_thread else: - from starlette.concurrency import run_in_threadpool as aio_to_thread + try: + from starlette.concurrency import run_in_threadpool as aio_to_thread + except ImportError: + pass PY2 = sys.version_info[0] == 2 # DO NOT REMOVE IT. ESP8266/ESP32 depend on it From 0e3249e8b1a13128633bb7ebc03e2ab5dbb03614 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 21 Mar 2024 21:08:41 +0200 Subject: [PATCH 38/39] Update deps --- platformio/dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/dependencies.py b/platformio/dependencies.py index 6bcb5f906a..5fd40a1d3a 100644 --- a/platformio/dependencies.py +++ b/platformio/dependencies.py @@ -45,7 +45,7 @@ def get_pip_dependencies(): # PIO Home requirements "ajsonrpc == 1.2.*", "starlette >=0.19, <0.38", - "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.29"), + "uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.30"), "wsproto == 1.*", ] From fcba901611d576af4d3c91cf504f38d4a23cb900 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 21 Mar 2024 21:11:15 +0200 Subject: [PATCH 39/39] Bump version to 6.1.14 --- 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 1e4bd6978a..6c83cbb591 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,7 +18,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.14 (2024-??-??) +6.1.14 (2024-03-21) ~~~~~~~~~~~~~~~~~~~ * Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format diff --git a/docs b/docs index 8528634148..670721e923 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8528634148a1edfdc96966ef6a1eb8456cfd8694 +Subproject commit 670721e9231cdedd1e28f9826759f7db70cab0e8 diff --git a/platformio/__init__.py b/platformio/__init__.py index 49b5bf7723..9bb65b5a4c 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, "14rc1") +VERSION = (6, 1, 14) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"