From 92073a4ccd2cd8f52964b0404eec5ed7fcc2a508 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 17 May 2022 18:57:40 +0300 Subject: [PATCH] Deprecate "pio update", "pio lib", and "pio platform" commands --- HISTORY.rst | 2 +- docs | 2 +- platformio/commands/lib/command.py | 9 ++++++++- platformio/commands/platform.py | 8 +++++++- platformio/commands/update.py | 32 ++++++------------------------ 5 files changed, 23 insertions(+), 30 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c8d278c2..3b5930ad 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,7 +16,7 @@ PlatformIO Core 6 ~~~~~~~~~~~~~~~~~~ * Improved support for the renamed configuration options (`issue #4270 `_) -* Fixed an issue when calling the built-in `pio device monitor `__ filter +* Fixed an issue when calling the built-in `pio device monitor `__ filters * Fixed an issue when using |INTERPOLATION| and merging str+int options (`issue #4271 `_) 6.0.0 (2022-05-16) diff --git a/docs b/docs index dfef63a7..2ea85922 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit dfef63a7f1ecc1112f8572e771189f579c51a407 +Subproject commit 2ea8592203cc647febcb1e13abca311a6ea99903 diff --git a/platformio/commands/lib/command.py b/platformio/commands/lib/command.py index 76210090..7e3f08e1 100644 --- a/platformio/commands/lib/command.py +++ b/platformio/commands/lib/command.py @@ -68,6 +68,14 @@ def get_project_global_lib_dir(): ) @click.pass_context def cli(ctx, **options): + in_silence = PlatformioCLI.in_silence() + if not in_silence: + click.secho( + "\nWARNING!!! This command is deprecated and will be removed in " + "the next releases. \nPlease use `pio pkg` instead.\n", + fg="yellow", + ) + storage_cmds = ("install", "uninstall", "update", "list") # skip commands that don't need storage folder if ctx.invoked_subcommand not in storage_cmds or ( @@ -94,7 +102,6 @@ def cli(ctx, **options): get_project_dir(), get_project_global_lib_dir(), ctx.invoked_subcommand ) - in_silence = PlatformioCLI.in_silence() ctx.meta[CTX_META_PROJECT_ENVIRONMENTS_KEY] = options["environment"] ctx.meta[CTX_META_INPUT_DIRS_KEY] = storage_dirs ctx.meta[CTX_META_STORAGE_DIRS_KEY] = [] diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index b35f056c..ae80566e 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -18,6 +18,7 @@ import os import click +from platformio.commands import PlatformioCLI from platformio.commands.boards import print_boards from platformio.exception import UserSideException from platformio.package.exception import UnknownPackageError @@ -30,7 +31,12 @@ from platformio.platform.factory import PlatformFactory @click.group(short_help="Platform manager", hidden=True) def cli(): - pass + if not PlatformioCLI.in_silence(): + click.secho( + "\nWARNING!!! This command is deprecated and will be removed in " + "the next releases. \nPlease use `pio pkg` instead.\n", + fg="yellow", + ) @cli.command("search", short_help="Search for development platform") diff --git a/platformio/commands/update.py b/platformio/commands/update.py index c0da8055..a4d0e196 100644 --- a/platformio/commands/update.py +++ b/platformio/commands/update.py @@ -14,12 +14,6 @@ import click -from platformio.commands.lib.command import CTX_META_STORAGE_DIRS_KEY -from platformio.commands.lib.command import lib_update as cmd_lib_update -from platformio.commands.platform import platform_update as cmd_platform_update -from platformio.package.manager.core import update_core_packages -from platformio.package.manager.library import LibraryPackageManager - @click.command( "update", @@ -36,23 +30,9 @@ from platformio.package.manager.library import LibraryPackageManager @click.option( "--dry-run", is_flag=True, help="Do not update, only check for the new versions" ) -@click.pass_context -def cli(ctx, core_packages, only_check, dry_run): - only_check = dry_run or only_check - - if not only_check: - update_core_packages() - - if core_packages: - return - - click.echo() - click.echo("Platform Manager") - click.echo("================") - ctx.invoke(cmd_platform_update, only_check=only_check) - - click.echo() - click.echo("Library Manager") - click.echo("===============") - ctx.meta[CTX_META_STORAGE_DIRS_KEY] = [LibraryPackageManager().package_dir] - ctx.invoke(cmd_lib_update, only_check=only_check) +def cli(*_, **__): + click.secho( + "This command is deprecated and will be removed in the next releases. \n" + "Please use `pio pkg update` instead.", + fg="yellow", + )