Introduce Packages component
We have been moving to component architecture where each app is made up of components. One of the last things remaining in this move is the Packages component. Introduce a new Packages component and use it all the apps. Rough suggestion for implementation:
In plinth/package.py
class Package(FollowerComponent):
def __init__(self, component_id, packages):
self.packages = packages
In each app/__init__.py
:
managed_packages = ['package1', 'package2']
class MyApp(app_module.App):
def __init__(self):
...
packages = package.Packages('myapp-packages', packages=managed_packages)
self.add(packages)
...
After this process is completed, (optionally) two additional cleanups can be done:
- Rewrite ForceUpgrader._filter_managed_packages() to use App.list() and app.get_components_of_type(Packages) instead of module.managed_packages.
- Rewrite has_unavailable_packages() to use app.get_components_of_type(Packages) instead of module.managed_packages. Improve views.SetupView() and setup.html so that this method is not called on a module but on an app.
Edited by Sunil Mohan Adapa