Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_package_lists(self):
- """Returns a pair consisting of all packages, followed by a dictionary
- mapping each package name to "static" or "dynamic".
- """
- # Filter the packages into static and dynamic parts. If a package is
- # dynamically loaded, all of its dependencies must also be dynamically
- # loaded. We use a simple greedy algorithm.
- package_types = dict()
- packages = []
- for plugins, package_type in (self.static_plugins, 'static'), \
- (self.dynamic_plugins, 'dynamic'):
- roots = dict()
- for name in plugins:
- roots[name] = self.get_package(name)
- for package in self.get_dependencies(roots.values()):
- package_types[package] = package_type
- if package not in packages:
- packages.append(package)
- return [(package, package_types[package])
- for package in packages]
- # I like that return value better. Alternatively:
- #return packages, [packages_types[__] for __ in packages]
- # Or, whatever.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement