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

compatible: Adapt collect-bases step to parse platforms keyword #250

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_bases(*, craft_: craft.Craft, yaml_data):

For snaps & rocks, the Ubuntu version is the same for all architectures.
"""
if craft_ is craft.Craft.ROCK:
if craft_ is craft.Craft.ROCK or "platforms" in yaml_data:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): I got a little worried of the fact that we may be looking for this string in the whole document. Turns out that yaml_data is a dict as this point. Would you mind adding a type hint in the signature?

# https://canonical-rockcraft.readthedocs-hosted.com/en/latest/reference/rockcraft.yaml/#platforms
return [craft.Architecture(arch) for arch in yaml_data["platforms"]]
if craft_ is craft.Craft.SNAP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def build_charm(
), f"Architecture for {bases_index=} ({architectures[0]}) does not match host architecture ({architecture})"
packed_charms = list(charm_path.glob(f"*{version}-{architecture}.charm"))
else:
packed_charms = list(charm_path.glob(f"*-{architecture}.charm"))
packed_charms = list(charm_path.glob(f"*{architecture}.charm"))
if len(packed_charms) == 1:
# python-libjuju's model.deploy(), juju deploy, and juju bundle files expect local charms
# to begin with `./` or `/` to distinguish them from Charmhub charms.
Expand Down