Skip to content

Commit

Permalink
WIP use open-stream-prefix craft-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
tigarmo committed Jun 16, 2023
1 parent 650adf7 commit b42e00d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ colorama==0.4.6
coverage==7.2.5
craft-archives==1.0.0
#craft-cli==1.2.0
git+https://github.com/canonical/craft-cli.git@main#egg=craft_cli
git+https://github.com/canonical/craft-cli.git@open-stream-prefix#egg=craft_cli
craft-grammar==1.1.1
craft-parts==1.21.1
craft-providers==1.13.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ charset-normalizer==3.1.0
click==8.1.3
craft-archives==1.0.0
#craft-cli==1.2.0
git+https://github.com/canonical/craft-cli.git@main#egg=craft_cli
git+https://github.com/canonical/craft-cli.git@open-stream-prefix#egg=craft_cli
craft-grammar==1.1.1
craft-parts==1.21.1
craft-providers==1.13.0
Expand Down
1 change: 0 additions & 1 deletion snapcraft/parts/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ def _run_lifecycle_and_pack(
parsed_args: "argparse.Namespace",
) -> None:
"""Execute the parts lifecycle, generate metadata, and create the snap."""
emit.message("USING craft-cli from branch 'main'")
with ua_manager.ua_manager(parsed_args.ua_token, services=project.ua_services):
lifecycle.run(
step_name,
Expand Down
8 changes: 5 additions & 3 deletions snapcraft/parts/parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def run(
for action in actions:
message = _action_message(action)
emit.progress(f"Executing parts lifecycle: {message}")
with emit.open_stream("Executing action") as stream:
prefix = f"Executing {_action_message(action, False)} :: "
# emit.progress(prefix, permanent=True)
with emit.open_stream("Executing action", prefix=prefix) as stream:
aex.execute(action, stdout=stream, stderr=stream)
emit.progress(f"Executed: {message}", permanent=True)

Expand Down Expand Up @@ -284,7 +286,7 @@ def launch_shell(*, cwd: Optional[pathlib.Path] = None) -> None:
subprocess.run(["bash"], check=False, cwd=cwd)


def _action_message(action: craft_parts.Action) -> str:
def _action_message(action: craft_parts.Action, add_reason=True) -> str:
msg = {
Step.PULL: {
ActionType.RUN: "pull",
Expand Down Expand Up @@ -319,7 +321,7 @@ def _action_message(action: craft_parts.Action) -> str:

message = f"{msg[action.step][action.action_type]} {action.part_name}"

if action.reason:
if action.reason and add_reason:
message += f" ({action.reason})"

return message

0 comments on commit b42e00d

Please sign in to comment.