From 9a18681ba62d1a297809c243607a7b3763131c36 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Mon, 16 Jul 2018 17:29:50 -0700 Subject: [WIP] Refactor and simplify python builds * pypodman namespaced in site-packages * version numbers pulled from requirements.txt * add python-podman spec file to install eggs Signed-off-by: Jhon Honce Closes: #1106 Approved by: rhatdan --- .../python/pypodman/lib/actions/images_action.py | 88 ---------------------- 1 file changed, 88 deletions(-) delete mode 100644 contrib/python/pypodman/lib/actions/images_action.py (limited to 'contrib/python/pypodman/lib/actions/images_action.py') diff --git a/contrib/python/pypodman/lib/actions/images_action.py b/contrib/python/pypodman/lib/actions/images_action.py deleted file mode 100644 index f6a7497e5..000000000 --- a/contrib/python/pypodman/lib/actions/images_action.py +++ /dev/null @@ -1,88 +0,0 @@ -"""Remote client commands dealing with images.""" -import operator -from collections import OrderedDict - -import humanize -import podman - -from .. import AbstractActionBase, Report, ReportColumn - - -class Images(AbstractActionBase): - """Class for Image manipulation.""" - - @classmethod - def subparser(cls, parent): - """Add Images commands to parent parser.""" - parser = parent.add_parser('images', help='list images') - super().subparser(parser) - parser.add_argument( - '--sort', - choices=['created', 'id', 'repository', 'size', 'tag'], - default='created', - type=str.lower, - help=('Change sort ordered of displayed images.' - ' (default: %(default)s)')) - - group = parser.add_mutually_exclusive_group() - group.add_argument( - '--digests', - action='store_true', - help='Include digests with images. (default: %(default)s)') - parser.set_defaults(class_=cls, method='list') - - def __init__(self, args): - """Construct Images class.""" - super().__init__(args) - - self.columns = OrderedDict({ - 'name': - ReportColumn('name', 'REPOSITORY', 40), - 'tag': - ReportColumn('tag', 'TAG', 10), - 'id': - ReportColumn('id', 'IMAGE ID', 12), - 'created': - ReportColumn('created', 'CREATED', 12), - 'size': - ReportColumn('size', 'SIZE', 8), - 'repoDigests': - ReportColumn('repoDigests', 'DIGESTS', 35), - }) - - def list(self): - """List images.""" - images = sorted( - self.client.images.list(), - key=operator.attrgetter(self._args.sort)) - if len(images) == 0: - return 0 - - rows = list() - for image in images: - fields = dict(image) - fields.update({ - 'created': - humanize.naturaldate(podman.datetime_parse(image.created)), - 'size': - humanize.naturalsize(int(image.size)), - 'repoDigests': - ' '.join(image.repoDigests), - }) - - for r in image.repoTags: - name, tag = r.split(':', 1) - fields.update({ - 'name': name, - 'tag': tag, - }) - rows.append(fields) - - if not self._args.digests: - del self.columns['repoDigests'] - - with Report(self.columns, heading=self._args.heading) as report: - report.layout( - rows, self.columns.keys(), truncate=self._args.truncate) - for row in rows: - report.row(**row) -- cgit v1.2.3-54-g00ecf