From ca3305863738f43d7ca93eb06a41707d627462ce Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 15 Jul 2020 23:16:46 +0300 Subject: [PATCH] New commands for the registry package management (pack, publish, unpublish) --- HISTORY.rst | 5 +++++ docs | 2 +- platformio/commands/lib.py | 19 +++---------------- platformio/commands/package.py | 14 ++++++++++++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8885bb03..43898869 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,11 @@ PlatformIO Core 4 - Manage organization teams - Manage resource access +* Registry Package Management + + - Publish a personal or organization package using `platformio package publish `__ command + - Remove a pushed package from the registry using `platformio package unpublish `__ command + * New `Custom Targets `__ - Pre/Post processing based on a dependent sources (other target, source file, etc.) diff --git a/docs b/docs index 0da1c281..0ed8c2da 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0da1c2810b62f69179cf797f0af6762d0eb9e8f9 +Subproject commit 0ed8c2da4db1952f027fb980045d37dc194614c4 diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index f635bff1..a1593732 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -25,8 +25,6 @@ from platformio import exception, fs, util from platformio.commands import PlatformioCLI from platformio.compat import dump_json_to_unicode from platformio.managers.lib import LibraryManager, get_builtin_libs, is_builtin_lib -from platformio.package.manifest.parser import ManifestParserFactory -from platformio.package.manifest.schema import ManifestSchema from platformio.proc import is_ci from platformio.project.config import ProjectConfig from platformio.project.exception import InvalidProjectConfError @@ -495,24 +493,13 @@ def lib_show(library, json_output): return True -@cli.command("register", short_help="Register a new library") +@cli.command("register", short_help="Deprecated") @click.argument("config_url") def lib_register(config_url): - if not config_url.startswith("http://") and not config_url.startswith("https://"): - raise exception.InvalidLibConfURL(config_url) - - # Validate manifest - ManifestSchema().load_manifest( - ManifestParserFactory.new_from_url(config_url).as_dict() + raise exception.UserSideException( + "This command is deprecated. Please use `pio package publish` command." ) - result = util.get_api_result("/lib/register", data=dict(config_url=config_url)) - if "message" in result and result["message"]: - click.secho( - result["message"], - fg="green" if "successed" in result and result["successed"] else "red", - ) - @cli.command("stats", short_help="Library Registry Statistics") @click.option("--json-output", is_flag=True) diff --git a/platformio/commands/package.py b/platformio/commands/package.py index b5e4ad06..73eb551a 100644 --- a/platformio/commands/package.py +++ b/platformio/commands/package.py @@ -38,7 +38,12 @@ def cli(): @cli.command("pack", short_help="Create a tarball from a package") -@click.argument("package", required=True, metavar="") +@click.argument( + "package", + required=True, + default=os.getcwd, + metavar="", +) @click.option( "-o", "--output", help="A destination path (folder or a full path to file)" ) @@ -49,7 +54,12 @@ def package_pack(package, output): @cli.command("publish", short_help="Publish a package to the registry") -@click.argument("package", required=True, metavar="") +@click.argument( + "package", + required=True, + default=os.getcwd, + metavar="", +) @click.option( "--owner", help="PIO Account username (can be organization username). "