def display_pkg(pkg, options): displaystyle = 'file' if options.package else 'local' if options.info > 0: pkginfo.display_pkginfo(pkg, level=options.info, style=displaystyle) elif not options.listfiles: if options.quiet: print(pkg.name) else: print(pkg.name, pkg.version) if options.listfiles: if options.quiet: [print('/' + path) for path, size, mode in pkg.files] else: [print(pkg.name, '/' + path) for path, size, mode in pkg.files]
def display_pkg(pkg, options): displaystyle = 'file' if options.package else 'local' if options.info > 0: pkginfo.display_pkginfo(pkg, level = options.info, style = displaystyle) elif not options.listfiles: if options.quiet: print(pkg.name) else: print(pkg.name, pkg.version) if options.listfiles: if options.quiet: [print('/' + path) for path, size, mode in pkg.files] else: [print(pkg.name, '/' + path) for path, size, mode in pkg.files]
def show_packages(args): "Show information about packages like pacman -Si" retcode = 0 if len(args.args) == 0: for repo in handle.get_syncdbs(): for pkg in repo.pkgcache: pkginfo.display_pkginfo(pkg, level=args.info, style="sync") else: repos = dict((db.name, db) for db in handle.get_syncdbs()) for pkgname in args.args: ok, value = find_sync_package(pkgname, repos) if ok: pkginfo.display_pkginfo(value, level=args.info, style="sync") else: retcode = 1 print("error:", value) return retcode
def show_packages(args): "Show information about packages like pacman -Si" retcode = 0 if len(args.args) == 0: for repo in handle.get_syncdbs(): for pkg in repo.pkgcache: pkginfo.display_pkginfo(pkg, level=args.info, style='sync') else: repos = dict((db.name, db) for db in handle.get_syncdbs()) for pkgname in args.args: ok, value = find_sync_package(pkgname, repos) if ok: pkginfo.display_pkginfo(value, level=args.info, style='sync') else: retcode = 1 print("error:", value) return retcode
def cli(ctx, config_file, pkgnames): handle = config.init_with_config(config_file) syncdbs = handle.get_syncdbs() db = handle.get_localdb() for name in pkgnames: pkg = eyapm.util.find_remote_package(syncdbs, name) if pkg is None: print('Error: target not found: %s' % name) continue local_pkg = db.get_pkg(name) if local_pkg: pkginfo.display_pkginfo(pkg, 2, 'local') else: pkginfo.display_pkginfo(pkg, 2, 'sync') print('')
def list_installed_packages(handle, pkgnames, show_detail): db = handle.get_localdb() pkglist = [] if not pkgnames: pkglist = db.pkgcache else: for name in pkgnames: pkg = db.get_pkg(name) if not pkg: print('error: package %s was not found' % name) sys.exit(-1) pkglist.append(pkg) if not show_detail: for pkg in pkglist: s = print_fmt.format( pkg.name, pkg.version ) print(s) else: for pkg in pkglist: pkginfo.display_pkginfo(pkg, 2)
def list_remote_packages(handle, pkgnames, show_detail): repos = handle.get_syncdbs() pkglist = [] if not pkgnames: for repo in repos: pkglist.extend(repo.pkgcache) else: for name in pkgnames: pkg = find_remote_package(name, repos) if pkg is None: print('error: package %s was not found' % name) sys.exit(-1) pkglist.append(pkg) if not show_detail: for pkg in pkglist: s = print_fmt.format( pkg.name, pkg.version ) print(s) else: for pkg in pkglist: pkginfo.display_pkginfo(pkg, 2, 'sync')