diff --git a/platformio/package/commands/list.py b/platformio/package/commands/list.py index c2426c9c..eff71100 100644 --- a/platformio/package/commands/list.py +++ b/platformio/package/commands/list.py @@ -135,20 +135,20 @@ def list_global_packages(options): ("libraries", LibraryPackageManager(options.get("storage_dir"))), ] only_packages = any( - options.get(type_) or options.get(f"only_{type_}") for (type_, _) in data + options.get(typex) or options.get(f"only_{typex}") for (typex, _) in data ) - for type_, pm in data: + for typex, pm in data: skip_conds = [ only_packages - and not options.get(type_) - and not options.get(f"only_{type_}"), + and not options.get(typex) + and not options.get(f"only_{typex}"), not pm.get_installed(), ] if any(skip_conds): continue - click.secho(type_.capitalize(), bold=True) + click.secho(typex.capitalize(), bold=True) print_dependency_tree( - pm, filter_specs=options.get(type_), verbose=options.get("verbose") + pm, filter_specs=options.get(typex), verbose=options.get("verbose") ) click.echo() @@ -156,12 +156,12 @@ def list_global_packages(options): def list_project_packages(options): environments = options["environments"] only_packages = any( - options.get(type_) or options.get(f"only_{type_}") - for type_ in ("platforms", "tools", "libraries") + options.get(typex) or options.get(f"only_{typex}") + for typex in ("platforms", "tools", "libraries") ) only_platform_packages = any( - options.get(type_) or options.get(f"only_{type_}") - for type_ in ("platforms", "tools") + options.get(typex) or options.get(f"only_{typex}") + for typex in ("platforms", "tools") ) only_library_packages = options.get("libraries") or options.get("only_libraries") diff --git a/platformio/package/commands/publish.py b/platformio/package/commands/publish.py index 228c1411..c8b4ea77 100644 --- a/platformio/package/commands/publish.py +++ b/platformio/package/commands/publish.py @@ -56,7 +56,7 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument ) @click.option( "--type", - "type_", + "typex", type=click.Choice(list(PackageType.items().values())), help="Custom package type", ) @@ -83,7 +83,7 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument hidden=True, ) def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals - package, owner, type_, released_at, private, notify, no_interactive, non_interactive + package, owner, typex, released_at, private, notify, no_interactive, non_interactive ): click.secho("Preparing a package...", fg="cyan") no_interactive = no_interactive or non_interactive @@ -103,14 +103,14 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals p = PackagePacker(package) archive_path = p.pack() - type_ = type_ or PackageType.from_archive(archive_path) + typex = typex or PackageType.from_archive(archive_path) manifest = ManifestSchema().load_manifest( ManifestParserFactory.new_from_archive(archive_path).as_dict() ) name = manifest.get("name") version = manifest.get("version") data = [ - ("Type:", type_), + ("Type:", typex), ("Owner:", owner), ("Name:", name), ("Version:", version), @@ -124,13 +124,13 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals check_archive_file_names(archive_path) # look for duplicates - check_package_duplicates(owner, type_, name, version, manifest.get("system")) + check_package_duplicates(owner, typex, name, version, manifest.get("system")) if not no_interactive: click.confirm( "Are you sure you want to publish the %s %s to the registry?\n" % ( - type_, + typex, click.style( "%s/%s@%s" % (owner, name, version), fg="cyan", @@ -146,7 +146,7 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals ) click.echo("Publishing...") response = RegistryClient().publish_package( - owner, type_, archive_path, released_at, private, notify + owner, typex, archive_path, released_at, private, notify ) if not do_not_pack: os.remove(archive_path) diff --git a/platformio/registry/client.py b/platformio/registry/client.py index 1a89e345..6173f7df 100644 --- a/platformio/registry/client.py +++ b/platformio/registry/client.py @@ -142,12 +142,12 @@ class RegistryClient(HTTPClient): x_with_authorization=self.allowed_private_packages(), ) - def get_package(self, type_, owner, name, version=None, extra_path=None): + def get_package(self, typex, owner, name, version=None, extra_path=None): try: return self.fetch_json_data( "get", "/v3/packages/{owner}/{type}/{name}{extra_path}".format( - type=type_, + type=typex, owner=owner.lower(), name=name.lower(), extra_path=extra_path or "",