Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move core22 commands for versioned implementation #4586

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/spread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ jobs:
env:
SPREAD_GOOGLE_KEY: ${{ secrets.SPREAD_GOOGLE_KEY }}
UA_TOKEN: ${{ secrets.UA_TOKEN }}
# Only run core24 tests for now; fix this once all those tests are OK
run: spread ${{ matrix.spread-jobs }}:tests/spread/core24/
run: spread ${{ matrix.spread-jobs }}

- name: Discard spread workers
if: always()
Expand Down
2 changes: 1 addition & 1 deletion snapcraft/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _get_dispatcher(self) -> craft_cli.Dispatcher:
extra_global_args=self._global_arguments,
# TODO: craft-application should allow setting the default command without
# overriding `_get_dispatcher()`
default_command=unimplemented.Pack,
default_command=craft_app_commands.lifecycle.PackCommand,
)

try:
Expand Down
94 changes: 47 additions & 47 deletions snapcraft/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,92 +42,92 @@
craft_cli.CommandGroup(
"Lifecycle",
[
commands.CleanCommand,
commands.PullCommand,
commands.BuildCommand,
commands.StageCommand,
commands.PrimeCommand,
commands.PackCommand,
commands.RemoteBuildCommand,
commands.SnapCommand, # hidden (legacy compatibility)
commands.PluginsCommand,
commands.ListPluginsCommand,
commands.TryCommand,
commands.core22.CleanCommand,
commands.core22.PullCommand,
commands.core22.BuildCommand,
commands.core22.StageCommand,
commands.core22.PrimeCommand,
commands.core22.PackCommand,
commands.core22.RemoteBuildCommand,
commands.core22.SnapCommand, # hidden (legacy compatibility)
commands.core22.PluginsCommand,
commands.core22.ListPluginsCommand,
commands.core22.TryCommand,
],
),
craft_cli.CommandGroup(
"Extensions",
[
commands.ListExtensionsCommand,
commands.ExtensionsCommand, # hidden (alias to list-extensions)
commands.ExpandExtensionsCommand,
commands.core22.ListExtensionsCommand,
commands.core22.ExtensionsCommand, # hidden (alias to list-extensions)
commands.core22.ExpandExtensionsCommand,
],
),
craft_cli.CommandGroup(
"Store Account",
[
commands.StoreLoginCommand,
commands.StoreExportLoginCommand,
commands.StoreLogoutCommand,
commands.StoreWhoAmICommand,
commands.core22.StoreLoginCommand,
commands.core22.StoreExportLoginCommand,
commands.core22.StoreLogoutCommand,
commands.core22.StoreWhoAmICommand,
],
),
craft_cli.CommandGroup(
"Store Snap Names",
[
commands.StoreRegisterCommand,
commands.StoreNamesCommand,
commands.StoreLegacyListRegisteredCommand,
commands.StoreLegacyListCommand,
commands.StoreLegacyMetricsCommand,
commands.StoreLegacyUploadMetadataCommand,
commands.core22.StoreRegisterCommand,
commands.core22.StoreNamesCommand,
commands.legacy.StoreLegacyListRegisteredCommand,
commands.legacy.StoreLegacyListCommand,
commands.legacy.StoreLegacyMetricsCommand,
commands.legacy.StoreLegacyUploadMetadataCommand,
],
),
craft_cli.CommandGroup(
"Store Snap Release Management",
[
commands.StoreReleaseCommand,
commands.StoreCloseCommand,
commands.StoreStatusCommand,
commands.StoreUploadCommand,
commands.StoreLegacyPushCommand, # hidden (legacy for upload)
commands.StoreLegacyPromoteCommand,
commands.StoreListRevisionsCommand,
commands.StoreRevisionsCommand, # hidden (alias to list-revisions)
commands.core22.StoreReleaseCommand,
commands.core22.StoreCloseCommand,
commands.core22.StoreStatusCommand,
commands.core22.StoreUploadCommand,
commands.legacy.StoreLegacyPushCommand, # hidden (legacy for upload)
commands.legacy.StoreLegacyPromoteCommand,
commands.core22.StoreListRevisionsCommand,
commands.core22.StoreRevisionsCommand, # hidden (alias to list-revisions)
],
),
craft_cli.CommandGroup(
"Store Snap Tracks",
[
commands.StoreListTracksCommand,
commands.StoreTracksCommand, # hidden (alias to list-tracks)
commands.StoreLegacySetDefaultTrackCommand,
commands.core22.StoreListTracksCommand,
commands.core22.StoreTracksCommand, # hidden (alias to list-tracks)
commands.legacy.StoreLegacySetDefaultTrackCommand,
],
),
craft_cli.CommandGroup(
"Store Key Management",
[
commands.StoreLegacyCreateKeyCommand,
commands.StoreLegacyRegisterKeyCommand,
commands.StoreLegacySignBuildCommand,
commands.StoreLegacyListKeysCommand,
commands.legacy.StoreLegacyCreateKeyCommand,
commands.legacy.StoreLegacyRegisterKeyCommand,
commands.legacy.StoreLegacySignBuildCommand,
commands.legacy.StoreLegacyListKeysCommand,
],
),
craft_cli.CommandGroup(
"Store Validation Sets",
[
commands.StoreEditValidationSetsCommand,
commands.StoreLegacyListValidationSetsCommand,
commands.StoreLegacyValidateCommand,
commands.StoreLegacyGatedCommand,
commands.core22.StoreEditValidationSetsCommand,
commands.legacy.StoreLegacyListValidationSetsCommand,
commands.legacy.StoreLegacyValidateCommand,
commands.legacy.StoreLegacyGatedCommand,
],
),
craft_cli.CommandGroup(
"Other",
[
commands.VersionCommand,
commands.LintCommand,
commands.InitCommand,
commands.core22.VersionCommand,
commands.core22.LintCommand,
commands.core22.InitCommand,
],
),
]
Expand Down Expand Up @@ -197,7 +197,7 @@ def get_dispatcher() -> craft_cli.Dispatcher:
COMMAND_GROUPS,
summary="Package, distribute, and update snaps for Linux and IoT",
extra_global_args=GLOBAL_ARGS,
default_command=commands.PackCommand,
default_command=commands.core22.PackCommand,
)


Expand Down
104 changes: 3 additions & 101 deletions snapcraft/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,107 +16,9 @@

"""Snapcraft commands."""

from .account import (
StoreExportLoginCommand,
StoreLoginCommand,
StoreLogoutCommand,
StoreWhoAmICommand,
)
from .discovery import ListPluginsCommand, PluginsCommand
from .extensions import (
ExpandExtensionsCommand,
ExtensionsCommand,
ListExtensionsCommand,
)
from .init import InitCommand
from .legacy import (
StoreLegacyCreateKeyCommand,
StoreLegacyGatedCommand,
StoreLegacyListKeysCommand,
StoreLegacyListValidationSetsCommand,
StoreLegacyMetricsCommand,
StoreLegacyPromoteCommand,
StoreLegacyRegisterKeyCommand,
StoreLegacySetDefaultTrackCommand,
StoreLegacySignBuildCommand,
StoreLegacyUploadMetadataCommand,
StoreLegacyValidateCommand,
)
from .lifecycle import (
BuildCommand,
CleanCommand,
PackCommand,
PrimeCommand,
PullCommand,
SnapCommand,
StageCommand,
TryCommand,
)
from .lint import LintCommand
from .manage import StoreCloseCommand, StoreReleaseCommand
from .names import (
StoreLegacyListCommand,
StoreLegacyListRegisteredCommand,
StoreNamesCommand,
StoreRegisterCommand,
)
from .remote import RemoteBuildCommand
from .status import (
StoreListRevisionsCommand,
StoreListTracksCommand,
StoreRevisionsCommand,
StoreStatusCommand,
StoreTracksCommand,
)
from .upload import StoreLegacyPushCommand, StoreUploadCommand
from .validation_sets import StoreEditValidationSetsCommand
from .version import VersionCommand
from . import core22, legacy

__all__ = [
"BuildCommand",
"CleanCommand",
"ExpandExtensionsCommand",
"ExtensionsCommand",
"InitCommand",
"LintCommand",
"ListExtensionsCommand",
"ListPluginsCommand",
"PackCommand",
"PluginsCommand",
"PrimeCommand",
"PullCommand",
"RemoteBuildCommand",
"SnapCommand",
"StageCommand",
"StoreCloseCommand",
"StoreEditValidationSetsCommand",
"StoreExportLoginCommand",
"StoreLegacyCreateKeyCommand",
"StoreLegacyGatedCommand",
"StoreLegacyListCommand",
"StoreLegacyListRegisteredCommand",
"StoreLegacyListValidationSetsCommand",
"StoreLegacyMetricsCommand",
"StoreLegacyPromoteCommand",
"StoreLegacyPushCommand",
"StoreLegacyRegisterKeyCommand",
"StoreLegacySetDefaultTrackCommand",
"StoreLegacySignBuildCommand",
"StoreLegacyUploadMetadataCommand",
"StoreLegacyValidateCommand",
"StoreLegacyListKeysCommand",
"StoreListTracksCommand",
"StoreListRevisionsCommand",
"StoreLoginCommand",
"StoreLogoutCommand",
"StoreNamesCommand",
"StoreRegisterCommand",
"StoreReleaseCommand",
"StoreRevisionsCommand",
"StoreStatusCommand",
"StoreTracksCommand",
"StoreUploadCommand",
"StoreWhoAmICommand",
"TryCommand",
"VersionCommand",
"core22",
"legacy",
]
90 changes: 90 additions & 0 deletions snapcraft/commands/core22/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2022 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Snapcraft commands for core22 base."""

from .account import (
StoreExportLoginCommand,
StoreLoginCommand,
StoreLogoutCommand,
StoreWhoAmICommand,
)
from .discovery import ListPluginsCommand, PluginsCommand
from .extensions import (
ExpandExtensionsCommand,
ExtensionsCommand,
ListExtensionsCommand,
)
from .init import InitCommand
from .lifecycle import (
BuildCommand,
CleanCommand,
PackCommand,
PrimeCommand,
PullCommand,
SnapCommand,
StageCommand,
TryCommand,
)
from .lint import LintCommand
from .manage import StoreCloseCommand, StoreReleaseCommand
from .names import StoreNamesCommand, StoreRegisterCommand
from .remote import RemoteBuildCommand
from .status import (
StoreListRevisionsCommand,
StoreListTracksCommand,
StoreRevisionsCommand,
StoreStatusCommand,
StoreTracksCommand,
)
from .upload import StoreUploadCommand
from .validation_sets import StoreEditValidationSetsCommand
from .version import VersionCommand

__all__ = [
"BuildCommand",
"CleanCommand",
"ExpandExtensionsCommand",
"ExtensionsCommand",
"InitCommand",
"LintCommand",
"ListExtensionsCommand",
"ListPluginsCommand",
"PackCommand",
"PluginsCommand",
"PrimeCommand",
"PullCommand",
"RemoteBuildCommand",
"SnapCommand",
"StageCommand",
"StoreCloseCommand",
"StoreEditValidationSetsCommand",
"StoreExportLoginCommand",
"StoreListTracksCommand",
"StoreListRevisionsCommand",
"StoreLoginCommand",
"StoreLogoutCommand",
"StoreNamesCommand",
"StoreRegisterCommand",
"StoreReleaseCommand",
"StoreRevisionsCommand",
"StoreStatusCommand",
"StoreTracksCommand",
"StoreUploadCommand",
"StoreWhoAmICommand",
"TryCommand",
"VersionCommand",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading