def status(snap_name, arch, experimental_progressive_releases): """Get the status on the store for <snap-name>. \b Examples: snapcraft status my-snap """ if experimental_progressive_releases: os.environ["SNAPCRAFT_EXPERIMENTAL_PROGRESSIVE_RELEASES"] = "Y" echo.warning("*EXPERIMENTAL* progressive releases in use.") snap_channel_map = StoreClientCLI().get_snap_channel_map( snap_name=snap_name) existing_architectures = snap_channel_map.get_existing_architectures() if not snap_channel_map.channel_map: echo.warning("This snap has no released revisions.") elif arch and arch not in existing_architectures: echo.warning(f"No revisions for architecture {arch!r}.") else: if arch: architectures = (arch, ) else: architectures = existing_architectures click.echo( get_tabulated_channel_map(snap_channel_map, architectures=architectures))
def status(snap_name, architectures, tracks, experimental_progressive_releases): """Get the status on the store for <snap-name>. \b Examples: snapcraft status my-snap snapcraft status --track 20 my-snap snapcraft status --arch amd64 my-snap """ if experimental_progressive_releases: os.environ["SNAPCRAFT_EXPERIMENTAL_PROGRESSIVE_RELEASES"] = "Y" echo.warning("*EXPERIMENTAL* progressive releases in use.") snap_channel_map = StoreClientCLI().get_snap_channel_map( snap_name=snap_name) existing_architectures = snap_channel_map.get_existing_architectures() if not snap_channel_map.channel_map: echo.warning("This snap has no released revisions.") else: if architectures: architectures = set(architectures) for architecture in architectures.copy(): if architecture not in existing_architectures: echo.warning( f"No revisions for architecture {architecture!r}.") architectures.remove(architecture) # If we have no revisions for any of the architectures requested, there's # nothing to do here. if not architectures: return else: architectures = existing_architectures if tracks: tracks = set(tracks) existing_tracks = { s.track for s in snap_channel_map.snap.channels if s.track in tracks } for track in tracks - existing_tracks: echo.warning(f"No revisions in track {track!r}.") tracks = existing_tracks # If we have no revisions in any of the tracks requested, there's # nothing to do here. if not tracks: return else: tracks = None click.echo( get_tabulated_channel_map(snap_channel_map, architectures=architectures, tracks=tracks))