def execute(self, args, uargs): pm = PackageManager() metafilter = MetaPackageFilter() if args.only_master_packages: metafilter.only_master_packages() if args.tags is not None: for t in args.tags: metafilter.with_tag(t) if args.keywords is not None and len(args.keywords) > 0: for kw in args.keywords: metafilter.with_keyword(kw) # Pkg list mflist = sorted(pm.list_available_packages().values(), key=IDENTIFIER_GETTER) # manage tags TagUtils.tag_latest(mflist) TagUtils.tag_installed(mflist, pm.list_installed_packages().keys()) # Print filtered packages rend = ManifestListRenderer(metafilter) rend.extend(filter(metafilter.matches, mflist)) pm.print_renderer(rend)
def execute(self, args, uargs): pm = PackageManager() metafilter = MetaPackageFilter() if not get_optional_arg(args, "show_all_packages", False): metafilter.only_master_packages() for t in get_optional_arg(args, "tags", []): metafilter.with_tag(t) for kw in get_optional_arg(args, "keywords", []): metafilter.with_keyword(kw) # Print filtered packages rend = ManifestListRenderer(metafilter) mflist = pm.list_installed_packages().values() rend.extend(filter(metafilter.matches, mflist)) pm.print_renderer(rend)
def execute(self, args, uargs): pm = PackageManager() env = None # If the user specified env values, build a complete env if args.custom_envlist is not None: env = Environment.build( pm.build_builtin_environment(), pm.build_user_environment(), Environment("Custom env", env_list_to_map(args.custom_envlist))) items = None if args.dependency_type == "available": items = DependencyUtils.install(PackageIdentifier.parse_list( args.packages), pm.list_available_packages(), {}, env=env) elif args.dependency_type == "install": items = DependencyUtils.install(PackageIdentifier.parse_list( args.packages), pm.list_available_packages(), pm.list_installed_packages(), env=env) elif args.dependency_type == "installed": items = DependencyUtils.installed(PackageIdentifier.parse_list( args.packages), pm.list_installed_packages(), env=env, ignore_unknown=True) elif args.dependency_type == "uninstall": items = DependencyUtils.uninstall(PackageIdentifier.parse_list( args.packages), pm.list_installed_packages(), env=env) elif args.dependency_type == "prereq": items = DependencyUtils.prereq(PackageIdentifier.parse_list( args.packages), pm.list_available_packages(), pm.list_installed_packages(), env=env) elif args.dependency_type == "upgrade": items, _ = DependencyUtils.upgrade( None if len(args.packages) == 0 else args.packages, pm.list_available_packages(), pm.list_installed_packages(), env=env) elif args.dependency_type == "rdepends": mfmap = OrderedDict() mfmap.update( DependencyUtils.rdepends(PackageIdentifier.parse_list( args.packages), pm.list_available_packages(), env=env)) mfmap.update( DependencyUtils.rdepends(PackageIdentifier.parse_list( args.packages), pm.list_installed_packages(), env=env)) items = mfmap.values() else: raise ValueError() rend = ManifestListRenderer() rend.extend(items) pm.print_renderer(rend)