diff --git a/platformio/clients/registry.py b/platformio/clients/registry.py index 7ab3a3c4..03e5b178 100644 --- a/platformio/clients/registry.py +++ b/platformio/clients/registry.py @@ -25,16 +25,18 @@ class RegistryClient(RESTClient): def publish_package( self, archive_path, owner=None, released_at=None, private=False ): - client = AccountClient() + account = AccountClient() if not owner: - owner = client.get_account_info(offline=True).get("profile").get("username") + owner = ( + account.get_account_info(offline=True).get("profile").get("username") + ) with open(archive_path, "rb") as fp: response = self.send_request( "post", "/v3/package/%s/%s" % (owner, PackageType.from_archive(archive_path)), params={"private": 1 if private else 0, "released_at": released_at}, headers={ - "Authorization": "Bearer %s" % client.fetch_authentication_token() + "Authorization": "Bearer %s" % account.fetch_authentication_token() }, data=fp, ) diff --git a/platformio/commands/package.py b/platformio/commands/package.py index a2b6c383..261523e2 100644 --- a/platformio/commands/package.py +++ b/platformio/commands/package.py @@ -34,6 +34,14 @@ def cli(): pass +@cli.command("pack", short_help="Create a tarball from a package") +@click.argument("package", required=True, metavar="[source directory, tar.gz or zip]") +def package_pack(package): + p = PackagePacker(package) + tarball_path = p.pack() + click.secho('Wrote a tarball to "%s"' % tarball_path, fg="green") + + @cli.command( "publish", short_help="Publish a package to the PlatformIO Universal Registry" ) diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index d4ff4930..c4a9ca5d 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -20,7 +20,6 @@ from platformio import app, exception, util from platformio.commands.boards import print_boards from platformio.compat import dump_json_to_unicode from platformio.managers.platform import PlatformFactory, PlatformManager -from platformio.package.pack import PackagePacker @click.group(short_help="Platform Manager") @@ -411,13 +410,3 @@ def platform_update( # pylint: disable=too-many-locals click.echo() return True - - -@cli.command( - "pack", short_help="Create a tarball from development platform/tool package" -) -@click.argument("package", required=True, metavar="[source directory, tar.gz or zip]") -def platform_pack(package): - p = PackagePacker(package) - tarball_path = p.pack() - click.secho('Wrote a tarball to "%s"' % tarball_path, fg="green")