diff --git a/docs b/docs index b130133b..a5a47214 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b130133bb73cc5f2b8c2b2288c11b5385a22c7d7 +Subproject commit a5a472148cf06a33a65e5cdd2edcaab5cc6e689a diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 5d44417e..70ac4b39 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -332,9 +332,6 @@ def platform_uninstall(platforms): help="Do not update, only check for a new version") @click.option("--json-output", is_flag=True) def platform_update(platforms, only_packages, only_check, json_output): - # cleanup cached board and platform lists - app.clean_cache() - pm = PlatformManager() pkg_dir_to_name = {} if not platforms: @@ -366,6 +363,8 @@ def platform_update(platforms, only_packages, only_check, json_output): result.append(data) return click.echo(json.dumps(result)) else: + # cleanup cached board and platform lists + app.clean_cache() for platform in platforms: click.echo("Platform %s" % click.style( pkg_dir_to_name.get(platform, platform), fg="cyan")) diff --git a/platformio/commands/update.py b/platformio/commands/update.py index 95511e44..41d0185d 100644 --- a/platformio/commands/update.py +++ b/platformio/commands/update.py @@ -14,6 +14,7 @@ import click +from platformio import app from platformio.commands.lib import lib_update as cmd_lib_update from platformio.commands.platform import platform_update as cmd_platform_update from platformio.managers.core import update_core_packages @@ -22,15 +23,23 @@ from platformio.managers.lib import LibraryManager @click.command( "update", short_help="Update installed platforms, packages and libraries") +@click.option( + "--core-packages", is_flag=True, help="Update only the core packages") @click.option( "-c", "--only-check", is_flag=True, help="Do not update, only check for new version") @click.pass_context -def cli(ctx, only_check): +def cli(ctx, core_packages, only_check): update_core_packages(only_check) + if core_packages: + return + + # cleanup lib search results, cached board and platform lists + app.clean_cache() + click.echo() click.echo("Platform Manager") click.echo("================") diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 9cd95719..df811972 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -59,8 +59,6 @@ def on_platformio_start(ctx, force, caller): app.set_session_var("caller_id", caller) telemetry.on_command() - if ctx.args and ctx.args[0] == "update": - app.clean_cache() if not in_silence(ctx): after_upgrade(ctx) @@ -159,7 +157,7 @@ def after_upgrade(ctx): app.clean_cache() # Update PlatformIO's Core packages - update_core_packages() + update_core_packages(silent=True) u = Upgrader(last_version, __version__) if u.run(ctx): diff --git a/platformio/managers/core.py b/platformio/managers/core.py index fabe449e..c711fcc6 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -21,7 +21,6 @@ from platformio import exception, util from platformio.managers.package import PackageManager CORE_PACKAGES = { - "project-templates": "*", "pysite-pioplus": ">=0.3.0,<2", "tool-pioplus": ">=0.6.10,<2", "tool-unity": "~1.20302.1", @@ -53,11 +52,13 @@ def get_core_package_dir(name): return pm.install(name, requirements) -def update_core_packages(only_check=False): +def update_core_packages(only_check=False, silent=False): pm = CorePackageManager() for name, requirements in CORE_PACKAGES.items(): pkg_dir = pm.get_package_dir(name) - if pkg_dir and pm.outdated(pkg_dir, requirements): + if not pkg_dir: + continue + if not silent or pm.outdated(pkg_dir, requirements): pm.update(name, requirements, only_check=only_check)