Skip to content

Commit

Permalink
refactor: change pack command parent
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal committed May 9, 2024
1 parent f8b4d8c commit 8e68ca7
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions snapcraft/commands/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Snapcraft lifecycle commands."""

import argparse
import pathlib
import textwrap
from typing import Any

Expand All @@ -28,7 +27,7 @@
import snapcraft.pack


class PackCommand(craft_application.commands.LifecycleCommand):
class PackCommand(craft_application.commands.lifecycle.PackCommand):
"""Snapcraft pack command."""

name = "pack"
Expand All @@ -54,13 +53,6 @@ def _fill_parser(self, parser: argparse.ArgumentParser) -> None:
default=None,
help="Directory to pack",
)
parser.add_argument(
"--output",
"-o",
type=pathlib.Path,
default=pathlib.Path(),
help="Output directory for created packages",
)

@override
def _run(
Expand All @@ -78,21 +70,6 @@ def _run(
emit.message(f"Packed {snap_filename}")
else:
super()._run(parsed_args, step_name="prime")
self._services.package.update_project()
self._services.package.write_metadata(self._services.lifecycle.prime_dir)

emit.progress("Packing...")
packages = self._services.package.pack(
self._services.lifecycle.prime_dir, parsed_args.output
)

if not packages:
emit.progress("No packages created.", permanent=True)
elif len(packages) == 1:
emit.progress(f"Packed {packages[0].name}", permanent=True)
else:
package_names = ", ".join(pkg.name for pkg in packages)
emit.progress(f"Packed: {package_names}", permanent=True)

@override
def needs_project(self, parsed_args: argparse.Namespace) -> bool:
Expand Down

0 comments on commit 8e68ca7

Please sign in to comment.