def publish_package(self, archive_path, owner=None, released_at=None, private=False, notify=True): account = AccountClient() if not owner: owner = (account.get_account_info( offline=True).get("profile").get("username")) with open(archive_path, "rb") as fp: return self.send_auth_request( "post", "/v3/packages/%s/%s" % (owner, PackageType.from_archive(archive_path)), params={ "private": 1 if private else 0, "notify": 1 if notify else 0, "released_at": released_at, }, headers={ "Content-Type": "application/octet-stream", "X-PIO-Content-SHA256": fs.calculate_file_hashsum("sha256", archive_path), }, data=fp, )
p = PackagePacker(package) archive_path = p.pack() response = RegistryClient().publish_package( archive_path, owner, released_at, private, notify ) os.remove(archive_path) click.secho(response.get("message"), fg="green") @cli.command("unpublish", short_help="Remove a pushed package from the registry") @click.argument( "package", required=True, metavar="[<organization>/]<pkgname>[@<version>]" ) @click.option( "--type", type=click.Choice(list(PackageType.items().values())), default="library", help="Package type, default is set to `library`", ) @click.option( "--undo", is_flag=True, help="Undo a remove, putting a version back into the registry", ) def package_unpublish(package, type, undo): # pylint: disable=redefined-builtin spec = PackageSpec(package) response = RegistryClient().unpublish_package( type=type, name=spec.name, owner=spec.owner, version=str(spec.requirements),
def manifest_names(self): return PackageType.get_manifest_map()[PackageType.LIBRARY]
def manifest_names(self): return PackageType.get_manifest_map()[PackageType.PLATFORM]